diff --git a/modules/applications/labwc/home.nix b/modules/applications/labwc/home.nix index aa8fea9..474037b 100644 --- a/modules/applications/labwc/home.nix +++ b/modules/applications/labwc/home.nix @@ -2,19 +2,39 @@ let systemctl = lib.getExe' pkgs.systemd "systemctl"; - action = key: name: { + keybind = key: actionAttrs: { "@key" = key; - action = { - "@name" = name; - }; + action = actionAttrs; }; - execute = key: command: { - "@key" = key; - action = { + action = + key: name: + keybind key { + "@name" = name; + }; + + execute = + key: command: + keybind key { "@name" = "Execute"; "@command" = command; }; + + snapToEdge = + key: direction: + keybind key { + "@name" = "SnapToEdge"; + "@direction" = direction; + "@combine" = "yes"; + }; + + confirmAction = key: message: name: { + "@key" = key; + action = { + "@name" = "If"; + prompt."@message" = message; + "then".action."@name" = name; + }; }; in { @@ -40,6 +60,7 @@ in default = true; numlock = "on"; keybind = [ + # labwc window management (action "W-q" "Close") (action "W-f" "ToggleMaximize") (action "W-c" "Iconify") @@ -49,56 +70,36 @@ in (action "W-Down" "Raise") (action "W-Left" "NextWindow") (action "W-Right" "PreviousWindow") - { - "@key" = "W-C-Left"; - action = { - "@name" = "SnapToEdge"; - "@direction" = "left"; - "@combine" = "yes"; - }; - } - { - "@key" = "W-C-Right"; - action = { - "@name" = "SnapToEdge"; - "@direction" = "right"; - "@combine" = "yes"; - }; - } - { - "@key" = "W-C-Up"; - action = { - "@name" = "SnapToEdge"; - "@direction" = "up"; - "@combine" = "yes"; - }; - } - { - "@key" = "W-C-Down"; - action = { - "@name" = "SnapToEdge"; - "@direction" = "down"; - "@combine" = "yes"; - }; - } + (snapToEdge "W-C-Left" "left") + (snapToEdge "W-C-Right" "right") + (snapToEdge "W-C-Up" "up") + (snapToEdge "W-C-Down" "down") + (confirmAction "W-S-e" "Exit labwc?" "Exit") + + # spawn applications (sync with niri modules/applications/niri/home.nix) (execute "W-t" "ghostty") (execute "W-d" "vicinae toggle") + (execute "W-s" "noctalia msg panel-toggle launcher") (execute "W-e" "nautilus --new-window") (execute "W-l" "loginctl lock-session") (execute "W-v" "vicinae vicinae://launch/clipboard/history?toggle=true") (execute "W-space" "ghostty +toggle-quick-terminal") (execute "W-p" "wdisplays") - (execute "W-s" "noctalia msg panel-toggle launcher") - (execute "W-comma" "noctalia msg settings-toggle") - (action "W-S-e" "Exit") - ] - ++ [ + + # Function keys (sync with niri modules/applications/niri/home.nix) (execute "XF86AudioRaiseVolume" "noctalia msg volume-up") (execute "XF86AudioLowerVolume" "noctalia msg volume-down") (execute "XF86AudioMute" "noctalia msg volume-mute") (execute "XF86AudioMicMute" "noctalia msg mic-mute") (execute "XF86MonBrightnessUp" "noctalia msg brightness-up") (execute "XF86MonBrightnessDown" "noctalia msg brightness-down") + (execute "XF86Favorites" "noctalia msg caffeine-toggle") + (execute "XF86AudioPlay" "playerctl play-pause") + (execute "XF86AudioPause" "playerctl play-pause") + (execute "XF86AudioStop" "playerctl stop") + (execute "XF86AudioPrev" "playerctl previous") + (execute "XF86AudioNext" "playerctl next") + (execute "XF86Display" "wdisplays") ]; }; diff --git a/modules/applications/niri/home.nix b/modules/applications/niri/home.nix index 941b52d..b0da7c1 100644 --- a/modules/applications/niri/home.nix +++ b/modules/applications/niri/home.nix @@ -6,6 +6,42 @@ in programs.niri.settings = { binds = keybindings // { + # niri window or focus move + "Mod+Shift+Left" = { + action.focus-monitor-left = [ ]; + hotkey-overlay.title = "Focus Monitor Left"; + }; + "Mod+Shift+Right" = { + action.focus-monitor-right = [ ]; + hotkey-overlay.title = "Focus Monitor Right"; + }; + "Mod+Shift+Up" = { + action.focus-monitor-up = [ ]; + hotkey-overlay.title = "Focus Monitor Up"; + }; + "Mod+Shift+Down" = { + action.focus-monitor-down = [ ]; + hotkey-overlay.title = "Focus Monitor Down"; + }; + + "Mod+Shift+Ctrl+Left" = { + action.move-window-to-monitor-left = [ ]; + hotkey-overlay.title = "Move Window to Monitor Left"; + }; + "Mod+Shift+Ctrl+Right" = { + action.move-window-to-monitor-right = [ ]; + hotkey-overlay.title = "Move Window to Monitor Right"; + }; + "Mod+Shift+Ctrl+Up" = { + action.move-window-to-monitor-up = [ ]; + hotkey-overlay.title = "Move Window to Monitor Up"; + }; + "Mod+Shift+Ctrl+Down" = { + action.move-window-to-monitor-down = [ ]; + hotkey-overlay.title = "Move Window to Monitor Down"; + }; + + # spawn applications (sync with labwc modules/applications/labwc/home.nix) "Mod+T" = { action.spawn = "ghostty"; hotkey-overlay.title = "Open a Terminal: ghostty"; @@ -54,41 +90,12 @@ in ]; hotkey-overlay.title = "Toggle Quick Terminal: ghostty"; }; - - "Mod+Shift+Left" = { - action.focus-monitor-left = [ ]; - hotkey-overlay.title = "Focus Monitor Left"; - }; - "Mod+Shift+Right" = { - action.focus-monitor-right = [ ]; - hotkey-overlay.title = "Focus Monitor Right"; - }; - "Mod+Shift+Up" = { - action.focus-monitor-up = [ ]; - hotkey-overlay.title = "Focus Monitor Up"; - }; - "Mod+Shift+Down" = { - action.focus-monitor-down = [ ]; - hotkey-overlay.title = "Focus Monitor Down"; - }; - - "Mod+Shift+Ctrl+Left" = { - action.move-window-to-monitor-left = [ ]; - hotkey-overlay.title = "Move Window to Monitor Left"; - }; - "Mod+Shift+Ctrl+Right" = { - action.move-window-to-monitor-right = [ ]; - hotkey-overlay.title = "Move Window to Monitor Right"; - }; - "Mod+Shift+Ctrl+Up" = { - action.move-window-to-monitor-up = [ ]; - hotkey-overlay.title = "Move Window to Monitor Up"; - }; - "Mod+Shift+Ctrl+Down" = { - action.move-window-to-monitor-down = [ ]; - hotkey-overlay.title = "Move Window to Monitor Down"; + "Mod+P" = { + action.spawn = "wdisplays"; + hotkey-overlay.title = "Display Settings: wdisplays"; }; + # Function keys (sync with labwc modules/applications/labwc/home.nix) "XF86AudioRaiseVolume".action.spawn = [ "noctalia" "msg" @@ -124,6 +131,29 @@ in "msg" "caffeine-toggle" ]; + "XF86AudioPlay".action.spawn = [ + "playerctl" + "play-pause" + ]; + "XF86AudioPause".action.spawn = [ + "playerctl" + "play-pause" + ]; + "XF86AudioStop".action.spawn = [ + "playerctl" + "stop" + ]; + "XF86AudioPrev".action.spawn = [ + "playerctl" + "previous" + ]; + "XF86AudioNext".action.spawn = [ + "playerctl" + "next" + ]; + "XF86Display".action.spawn = [ + "wdisplays" + ]; }; input = {