lol

kdePackages.koi: patch hardcoded binary paths

Co-authored-by: alexyao2015 <33379584+alexyao2015@users.noreply.github.com>

+69
+44
pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch
··· 1 + diff --git a/src/plugins/colorscheme.cpp b/src/plugins/colorscheme.cpp 2 + index 7c51806..4d8015b 100644 3 + --- a/src/plugins/colorscheme.cpp 4 + +++ b/src/plugins/colorscheme.cpp 5 + @@ -3,16 +3,7 @@ 6 + #include <QProcess> 7 + 8 + void ColorScheme::setTheme(QString themeName) { 9 + - QProcess process; 10 + - QString locateProgram = "whereis"; 11 + - QStringList programToLocate = {"plasma-apply-colorscheme"}; 12 + - 13 + - process.start(locateProgram, programToLocate); 14 + - process.waitForFinished(); 15 + - 16 + - QString program(process.readAllStandardOutput()); 17 + - program.replace("plasma-apply-colorscheme: ", ""); 18 + - program.replace("\n", ""); 19 + + QString program("@plasma-apply-colorscheme@"); 20 + 21 + QStringList arguments{themeName}; 22 + QProcess::startDetached(program, arguments); 23 + diff --git a/src/plugins/icons.cpp b/src/plugins/icons.cpp 24 + index 1cc306f..745d042 100644 25 + --- a/src/plugins/icons.cpp 26 + +++ b/src/plugins/icons.cpp 27 + @@ -5,16 +5,7 @@ 28 + void Icons::setTheme(QString iconTheme) { 29 + 30 + // locate plasma-changeicons program 31 + - QProcess process; 32 + - QString locateProgram = "whereis"; 33 + - QStringList programToLocate = {"plasma-changeicons"}; 34 + - 35 + - process.start(locateProgram, programToLocate); 36 + - process.waitForFinished(); 37 + - 38 + - QString program(process.readAllStandardOutput()); 39 + - program.replace("plasma-changeicons: ", ""); 40 + - program.replace("\n", ""); 41 + + QString program("@plasma-changeicons@"); 42 + 43 + // apply the icon theme 44 + QStringList arguments{iconTheme};
+25
pkgs/kde/third-party/koi/default.nix
··· 7 7 kcoreaddons, 8 8 kwidgetsaddons, 9 9 wrapQtAppsHook, 10 + kdbusaddons, 11 + kde-cli-tools, 12 + plasma-workspace, 13 + qtstyleplugin-kvantum, 10 14 }: 11 15 stdenv.mkDerivation (finalAttrs: { 12 16 pname = "koi"; ··· 18 22 tag = finalAttrs.version; 19 23 hash = "sha256-fXLGlq41Qwdp0cYJcNqPlYnlpVXsZk0imYxP7Bgdcvw="; 20 24 }; 25 + 26 + patches = [ 27 + # koi tries to access KDE utility binaries at their absolute paths or by using `whereis`. 28 + # We patch the absolute paths below in `postPatch` and replace the `whereis` invocations 29 + # here with a placeholder that is also substituted in `postPatch`. 30 + ./0001-locate-plasma-tools.patch 31 + ]; 32 + 33 + postPatch = '' 34 + substituteInPlace src/utils.cpp \ 35 + --replace-fail /usr/bin/kquitapp6 ${lib.getExe' kdbusaddons "kquitapp6"} \ 36 + --replace-fail /usr/bin/kstart ${lib.getExe' kde-cli-tools "kstart"} 37 + substituteInPlace src/plugins/plasmastyle.cpp \ 38 + --replace-fail /usr/bin/plasma-apply-desktoptheme ${lib.getExe' plasma-workspace "plasma-apply-desktoptheme"} 39 + substituteInPlace src/plugins/colorscheme.cpp \ 40 + --replace-fail '@plasma-apply-colorscheme@' ${lib.getExe' plasma-workspace "plasma-apply-colorscheme"} 41 + substituteInPlace src/plugins/icons.cpp \ 42 + --replace-fail '@plasma-changeicons@' ${plasma-workspace}/libexec/plasma-changeicons 43 + substituteInPlace src/plugins/kvantumstyle.cpp \ 44 + --replace-fail /usr/bin/kvantummanager ${lib.getExe' qtstyleplugin-kvantum "kvantummanager"} 45 + ''; 21 46 22 47 nativeBuildInputs = [ 23 48 cmake