From 353ee355a369ab01c064c2da6d4c9c8831351dff Mon Sep 17 00:00:00 2001 From: "Eduardo B. A." <279828+sezaru@users.noreply.github.com> Date: Fri, 5 Sep 2025 22:38:01 -0300 Subject: [PATCH] Allow setting quickshell package (#165) * feat: Add config option to set quickshell package * refactor: Use configured quickshell package for ipc calls --------- Co-authored-by: Eduardo Barreto Alexandre --- flake.nix | 107 +++++++++++------------------------------------------- 1 file changed, 21 insertions(+), 86 deletions(-) diff --git a/flake.nix b/flake.nix index 238984a3..159c4ddd 100644 --- a/flake.nix +++ b/flake.nix @@ -42,12 +42,19 @@ lib.mkEnableOption "DankMaterialShell systemd startup"; enableSpawn = lib.mkEnableOption "DankMaterialShell Niri spawn-at-startup"; + + quickshell = { + package = lib.mkPackageOption pkgs "quickshell" { + default = quickshell.packages.${pkgs.system}.quickshell; + nullable = false; + }; + }; }; config = lib.mkIf cfg.enable { programs.quickshell = { enable = true; - package = quickshell.packages.${pkgs.system}.quickshell; + package = cfg.quickshell.package; configs.DankMaterialShell = "${ self.packages.${pkgs.system}.dankMaterialShell }/etc/xdg/quickshell/DankMaterialShell"; @@ -58,109 +65,37 @@ }; }; - programs.niri.settings = lib.mkMerge [ + programs.niri.settings = lib.mkMerge let + quickShellIpc = spawn "${cfg.quickshell.package}/bin/qs" "-c" "DankMaterialShell" "ipc" "call"; + in [ (lib.mkIf cfg.enableKeybinds { binds = { - "Mod+Space".action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "spotlight" - "toggle" - ]; - "Mod+V".action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "clipboard" - "toggle" - ]; - "Mod+M".action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "processlist" - "toggle" - ]; - "Mod+Comma".action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "settings" - "toggle" - ]; - "Super+Alt+L".action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "lock" - "lock" - ]; + "Mod+Space".action = quickShellIpc "spotlight" "toggle"; + "Mod+V".action = quickShellIpc "clipboard" "toggle"; + "Mod+M".action = quickShellIpc "processlist" "toggle"; + "Mod+Comma".action = quickShellIpc "settings" "toggle"; + "Super+Alt+L".action = quickShellIpc "lock" "lock"; "XF86AudioRaiseVolume" = { allow-when-locked = true; - action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "audio" - "increment" - "3" - ]; + action = quickShellIpc "audio" "increment" "3"; }; "XF86AudioLowerVolume" = { allow-when-locked = true; - action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "audio" - "decrement" - "3" - ]; + action = quickShellIpc "audio" "decrement" "3"; }; "XF86AudioMute" = { allow-when-locked = true; - action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "audio" - "mute" - ]; + action = quickShellIpc "audio" "mute"; }; "XF86AudioMicMute" = { allow-when-locked = true; - action.spawn = [ - "qs" - "-c" - "DankMaterialShell" - "ipc" - "call" - "audio" - "micmute" - ]; + action = quickShellIpc "audio" "micmute"; }; }; }) (lib.mkIf (cfg.enableSpawn) { spawn-at-startup = - [{ command = [ "qs" "-c" "DankMaterialShell" ]; }]; + [{ command = [ "${cfg.quickshell.package}/bin/qs" "-c" "DankMaterialShell" ]; }]; }) ];