dotfiles/flakes/de_plasma/home_manager/shortcuts.nix
2025-12-07 16:33:05 -06:00

56 lines
1.3 KiB
Nix

{ osConfig, lib, ... }:
let
cfg = osConfig.ringofstorms.dePlasma;
inherit (lib) mkIf;
workspaces = builtins.genList (i: i + 1) 9;
workspaceLetters = [ "n" "m" "," "." "/" ];
kwinWorkspace = builtins.listToAttrs (
map (i: {
name = "Switch to Desktop ${toString i}";
value =
let
idx = i - 1;
in
if idx < builtins.length workspaceLetters then
[ "Meta+${toString i}" "Meta+${builtins.elemAt workspaceLetters idx}" ]
else
"Meta+${toString i}";
}) workspaces
);
kwinMoveWorkspace = builtins.listToAttrs (
map (i: {
name = "Window to Desktop ${toString i}";
value = "Meta+Shift+${toString i}";
}) workspaces
);
in
{
options = { };
config = mkIf (cfg.enable) {
# Configure virtual desktops declaratively
programs.plasma.shortcuts = {
kwin = {
"Window Close" = "Meta+Q";
"Overview" = "Meta";
}
// kwinWorkspace
// kwinMoveWorkspace;
plasmashell = {
"activate application launcher widget" = [ ];
};
ksmserver = {
"Lock Session" = "Meta+Shift+L";
};
};
# Custom hotkey commands
programs.plasma.hotkeys.commands = {
terminal = {
key = "Meta+Return";
command = "kitty";
};
};
};
}