1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

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 <git@dummy.com>
This commit is contained in:
Eduardo B. A.
2025-09-05 22:38:01 -03:00
committed by GitHub
parent 79c21e67dc
commit 353ee355a3

107
flake.nix
View File

@@ -42,12 +42,19 @@
lib.mkEnableOption "DankMaterialShell systemd startup"; lib.mkEnableOption "DankMaterialShell systemd startup";
enableSpawn = enableSpawn =
lib.mkEnableOption "DankMaterialShell Niri spawn-at-startup"; 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 { config = lib.mkIf cfg.enable {
programs.quickshell = { programs.quickshell = {
enable = true; enable = true;
package = quickshell.packages.${pkgs.system}.quickshell; package = cfg.quickshell.package;
configs.DankMaterialShell = "${ configs.DankMaterialShell = "${
self.packages.${pkgs.system}.dankMaterialShell self.packages.${pkgs.system}.dankMaterialShell
}/etc/xdg/quickshell/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 { (lib.mkIf cfg.enableKeybinds {
binds = { binds = {
"Mod+Space".action.spawn = [ "Mod+Space".action = quickShellIpc "spotlight" "toggle";
"qs" "Mod+V".action = quickShellIpc "clipboard" "toggle";
"-c" "Mod+M".action = quickShellIpc "processlist" "toggle";
"DankMaterialShell" "Mod+Comma".action = quickShellIpc "settings" "toggle";
"ipc" "Super+Alt+L".action = quickShellIpc "lock" "lock";
"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"
];
"XF86AudioRaiseVolume" = { "XF86AudioRaiseVolume" = {
allow-when-locked = true; allow-when-locked = true;
action.spawn = [ action = quickShellIpc "audio" "increment" "3";
"qs"
"-c"
"DankMaterialShell"
"ipc"
"call"
"audio"
"increment"
"3"
];
}; };
"XF86AudioLowerVolume" = { "XF86AudioLowerVolume" = {
allow-when-locked = true; allow-when-locked = true;
action.spawn = [ action = quickShellIpc "audio" "decrement" "3";
"qs"
"-c"
"DankMaterialShell"
"ipc"
"call"
"audio"
"decrement"
"3"
];
}; };
"XF86AudioMute" = { "XF86AudioMute" = {
allow-when-locked = true; allow-when-locked = true;
action.spawn = [ action = quickShellIpc "audio" "mute";
"qs"
"-c"
"DankMaterialShell"
"ipc"
"call"
"audio"
"mute"
];
}; };
"XF86AudioMicMute" = { "XF86AudioMicMute" = {
allow-when-locked = true; allow-when-locked = true;
action.spawn = [ action = quickShellIpc "audio" "micmute";
"qs"
"-c"
"DankMaterialShell"
"ipc"
"call"
"audio"
"micmute"
];
}; };
}; };
}) })
(lib.mkIf (cfg.enableSpawn) { (lib.mkIf (cfg.enableSpawn) {
spawn-at-startup = spawn-at-startup =
[{ command = [ "qs" "-c" "DankMaterialShell" ]; }]; [{ command = [ "${cfg.quickshell.package}/bin/qs" "-c" "DankMaterialShell" ]; }];
}) })
]; ];