diff --git a/pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch b/pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch new file mode 100644 index 000000000000..2f4a8a2a7629 --- /dev/null +++ b/pkgs/kde/third-party/koi/0001-locate-plasma-tools.patch @@ -0,0 +1,44 @@ +diff --git a/src/plugins/colorscheme.cpp b/src/plugins/colorscheme.cpp +index 7c51806..4d8015b 100644 +--- a/src/plugins/colorscheme.cpp ++++ b/src/plugins/colorscheme.cpp +@@ -3,16 +3,7 @@ + #include + + void ColorScheme::setTheme(QString themeName) { +- QProcess process; +- QString locateProgram = "whereis"; +- QStringList programToLocate = {"plasma-apply-colorscheme"}; +- +- process.start(locateProgram, programToLocate); +- process.waitForFinished(); +- +- QString program(process.readAllStandardOutput()); +- program.replace("plasma-apply-colorscheme: ", ""); +- program.replace("\n", ""); ++ QString program("@plasma-apply-colorscheme@"); + + QStringList arguments{themeName}; + QProcess::startDetached(program, arguments); +diff --git a/src/plugins/icons.cpp b/src/plugins/icons.cpp +index 1cc306f..745d042 100644 +--- a/src/plugins/icons.cpp ++++ b/src/plugins/icons.cpp +@@ -5,16 +5,7 @@ + void Icons::setTheme(QString iconTheme) { + + // locate plasma-changeicons program +- QProcess process; +- QString locateProgram = "whereis"; +- QStringList programToLocate = {"plasma-changeicons"}; +- +- process.start(locateProgram, programToLocate); +- process.waitForFinished(); +- +- QString program(process.readAllStandardOutput()); +- program.replace("plasma-changeicons: ", ""); +- program.replace("\n", ""); ++ QString program("@plasma-changeicons@"); + + // apply the icon theme + QStringList arguments{iconTheme}; diff --git a/pkgs/kde/third-party/koi/default.nix b/pkgs/kde/third-party/koi/default.nix index 3a7e8ceda25d..3cdc6f2bc066 100644 --- a/pkgs/kde/third-party/koi/default.nix +++ b/pkgs/kde/third-party/koi/default.nix @@ -7,20 +7,43 @@ kcoreaddons, kwidgetsaddons, wrapQtAppsHook, + kdbusaddons, + kde-cli-tools, + plasma-workspace, + qtstyleplugin-kvantum, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "koi"; - version = "0.4"; + version = "0.5.1"; src = fetchFromGitHub { owner = "baduhai"; repo = "Koi"; - rev = version; - sha256 = "sha256-ip7e/Sz/l5UiTFUTLJPorPO7NltE2Isij2MCmvHZV40="; + tag = finalAttrs.version; + hash = "sha256-fXLGlq41Qwdp0cYJcNqPlYnlpVXsZk0imYxP7Bgdcvw="; }; - # See https://github.com/baduhai/Koi/blob/master/development/Nix%20OS/dev.nix - sourceRoot = "${src.name}/src"; + patches = [ + # koi tries to access KDE utility binaries at their absolute paths or by using `whereis`. + # We patch the absolute paths below in `postPatch` and replace the `whereis` invocations + # here with a placeholder that is also substituted in `postPatch`. + ./0001-locate-plasma-tools.patch + ]; + + postPatch = '' + substituteInPlace src/utils.cpp \ + --replace-fail /usr/bin/kquitapp6 ${lib.getExe' kdbusaddons "kquitapp6"} \ + --replace-fail /usr/bin/kstart ${lib.getExe' kde-cli-tools "kstart"} + substituteInPlace src/plugins/plasmastyle.cpp \ + --replace-fail /usr/bin/plasma-apply-desktoptheme ${lib.getExe' plasma-workspace "plasma-apply-desktoptheme"} + substituteInPlace src/plugins/colorscheme.cpp \ + --replace-fail '@plasma-apply-colorscheme@' ${lib.getExe' plasma-workspace "plasma-apply-colorscheme"} + substituteInPlace src/plugins/icons.cpp \ + --replace-fail '@plasma-changeicons@' ${plasma-workspace}/libexec/plasma-changeicons + substituteInPlace src/plugins/kvantumstyle.cpp \ + --replace-fail /usr/bin/kvantummanager ${lib.getExe' qtstyleplugin-kvantum "kvantummanager"} + ''; + nativeBuildInputs = [ cmake wrapQtAppsHook @@ -31,7 +54,7 @@ stdenv.mkDerivation rec { kwidgetsaddons ]; - meta = with lib; { + meta = { description = "Scheduling LIGHT/DARK Theme Converter for the KDE Plasma Desktop"; longDescription = '' Koi is a program designed to provide the KDE Plasma Desktop functionality to automatically switch between light and dark themes. Koi is under semi-active development, and while it is stable enough to use daily, expect bugs. Koi is designed to be used with Plasma, and while some features may function under different desktop environments, they are unlikely to work and untested. @@ -47,9 +70,10 @@ stdenv.mkDerivation rec { - Hide application to system tray - Toggle between LIGHT/DARK themes by clicking mouse wheel ''; - license = licenses.lgpl3; - platforms = platforms.linux; + license = lib.licenses.lgpl3; + platforms = lib.platforms.linux; + changelog = "https://github.com/baduhai/Koi/releases/tag/${finalAttrs.version}"; homepage = "https://github.com/baduhai/Koi"; maintainers = with lib.maintainers; [ fnune ]; }; -} +})