diff --git a/options/custom/desktops/hyprland/binds.nix b/options/custom/desktops/hyprland/binds.nix index a7fe553..dcf8548 100644 --- a/options/custom/desktops/hyprland/binds.nix +++ b/options/custom/desktops/hyprland/binds.nix @@ -17,9 +17,6 @@ with lib; let hyprlock = getExe hm.programs.hyprlock.package; hyprpicker = getExe pkgs.hyprpicker; inhibit = hm.home.file.".local/bin/inhibit".source; - jq = getExe pkgs.jq; - kill = getExe' pkgs.procps "kill"; - kitty = getExe hm.programs.kitty.package; left = hm.home.file.".local/bin/left".source; loginctl = getExe' pkgs.systemd "loginctl"; nautilus = getExe pkgs.nautilus; @@ -34,234 +31,245 @@ with lib; let steam = getExe config.programs.steam.package; swayosd-client = getExe' pkgs.swayosd "swayosd-client"; toggle = hm.home.file.".local/bin/toggle".source; + uwsm = getExe pkgs.uwsm; virt-manager = getExe config.programs.virt-manager.package; vrr = hm.home.file.".local/bin/vrr".source; waydroid = getExe pkgs.waydroid; window = hm.home.file.".local/bin/window".source; zoom = hm.home.file.".local/bin/zoom".source; + + command = command: "${uwsm} app -- ${command}"; in { - options.custom.desktops.hyprland.binds.enable = mkOption {default = false;}; + options.custom.desktops.hyprland.binds = { + enable = mkOption {default = false;}; + }; config = mkIf cfg.enable { - home-manager.users.${config.custom.username} = { - wayland.windowManager.hyprland.settings = let - # Reverse mods and key for alphabetical sorting - #?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null> - key = key: mods: dispatcher: params: "${ - if (isNull mods) - then "" - else mods - }, ${key}, ${dispatcher}${ - if (isNull params) - then "" - else ", ${params}" - }"; + home-manager.sharedModules = [ + { + wayland.windowManager.hyprland.settings = let + # Reverse mods and key for alphabetical sorting + #?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null> + key = key: mods: dispatcher: params: "${ + if (isNull mods) + then "" + else mods + }, ${key}, ${dispatcher}${ + if (isNull params) + then "" + else ", ${ + if dispatcher == "exec" + then command params + else params + }" + }"; - dropdown = concatStringsSep " " [ - "${toggle}" - "--focus" - "--type class" + dropdown = concatStringsSep " " [ + "${toggle}" + "--focus" + "--type class" "--expression '^.*dropdown$'" - "--workspace special:dropdown" - "--" + "--workspace special:dropdown" + "--" #!! Must be valid GTK class # https://github.com/ghostty-org/ghostty/issues/3336 "${ghostty} --class=gtk.dropdown" - ]; - - pip-switch = with config.custom; - concatStringsSep " " [ - "${window} move" - "--current" - "--property title" - "'^Picture.in.[Pp]icture$'" - "${toString (gap + border)},${toString (gap + border)}" ]; - pip-toggle = concatStringsSep " " [ - "${toggle}" - "--type title" - "--expression '^Picture.in.[Pp]icture$'" - "--workspace special:pip" - ]; + pip-switch = with config.custom; + concatStringsSep " " [ + "${window} move" + "--current" + "--property title" + "'^Picture.in.[Pp]icture$'" + "${toString (gap + border)},${toString (gap + border)}" + ]; - vm = ''${remote} --vm --client xfreerdp --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${ - if config.custom.hidpi - then "--scale 140" - else "" - } myndows''; - in { - # https://wiki.hyprland.org/Configuring/Binds - #?? bind = MODS, KEY, DISPATCHER, [PARAMS] - #?? wev + pip-toggle = concatStringsSep " " [ + "${toggle}" + "--type title" + "--expression '^Picture.in.[Pp]icture$'" + "--workspace special:pip" + ]; - # Regular binds - bind = []; + vm = ''${remote} --vm --client xfreerdp --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${ + if config.custom.hidpi + then "--scale 140" + else "" + } myndows''; + in { + # https://wiki.hyprland.org/Configuring/Binds + #?? bind = MODS, KEY, DISPATCHER, [PARAMS] + #?? wev - # Repeat binds - binde = [ - # Media keys - # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h - (key "XF86AudioMute" null "exec" "${swayosd-client} --output-volume mute-toggle") # F1 - (key "XF86AudioLowerVolume" null "exec" "${swayosd-client} --output-volume lower") # F2 - (key "XF86AudioRaiseVolume" null "exec" "${swayosd-client} --output-volume raise") # F3 - (key "XF86AudioPrev" null "exec" "${playerctl} previous") # F4 - (key "XF86AudioPlay" null "exec" "${playerctl} play-pause") # F5 - (key "XF86AudioNext" null "exec" "${playerctl} next") # F6 - (key "XF86MonBrightnessDown" null "exec" "${swayosd-client} --brightness lower") # F7 - (key "XF86MonBrightnessUp" null "exec" "${swayosd-client} --brightness raise") # F8 - (key "XF86AudioMedia" null "exec" "${notify-send} test") # F12 + # Regular binds + bind = []; - # Meta alternatives - (key "0" "Super" "exec" "${swayosd-client} --output-volume mute-toggle") - (key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower") - (key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise") - (key "Left" "Super" "exec" "${playerctl} previous") - (key "Delete" "Super" "exec" "${playerctl} play-pause") - (key "Right" "Super" "exec" "${playerctl} next") - (key "Down" "Super" "exec" "${swayosd-client} --brightness lower") - (key "Up" "Super" "exec" "${swayosd-client} --brightness raise") + # Repeat binds + binde = [ + # Media keys + # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h + (key "XF86AudioMute" null "exec" "${swayosd-client} --output-volume mute-toggle") # F1 + (key "XF86AudioLowerVolume" null "exec" "${swayosd-client} --output-volume lower") # F2 + (key "XF86AudioRaiseVolume" null "exec" "${swayosd-client} --output-volume raise") # F3 + (key "XF86AudioPrev" null "exec" "${playerctl} previous") # F4 + (key "XF86AudioPlay" null "exec" "${playerctl} play-pause") # F5 + (key "XF86AudioNext" null "exec" "${playerctl} next") # F6 + (key "XF86MonBrightnessDown" null "exec" "${swayosd-client} --brightness lower") # F7 + (key "XF86MonBrightnessUp" null "exec" "${swayosd-client} --brightness raise") # F8 + (key "XF86AudioMedia" null "exec" "${notify-send} test") # F12 - # Special keys - (key "Apostrophe" "Super" "exec" "${screenshot} selection") - (key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit") - (key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit") - (key "Apostrophe" "Super+Shift" "exec" "${screenshot} display") - (key "Backslash" "Super+Shift" "exec" power) - (key "Backspace" "Super" "scroller:alignwindow" "middle") - (key "Backspace" "Super+Shift" "scroller:fitsize" "visible") - (key "Equal" "Super+Shift" "exec" "${zoom} +0.1") + # Meta alternatives + (key "0" "Super" "exec" "${swayosd-client} --output-volume mute-toggle") + (key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower") + (key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise") + (key "Left" "Super" "exec" "${playerctl} previous") + (key "Delete" "Super" "exec" "${playerctl} play-pause") + (key "Right" "Super" "exec" "${playerctl} next") + (key "Down" "Super" "exec" "${swayosd-client} --brightness lower") + (key "Up" "Super" "exec" "${swayosd-client} --brightness raise") + + # Special keys + (key "Apostrophe" "Super" "exec" "${screenshot} selection") + (key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit") + (key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit") + (key "Apostrophe" "Super+Shift" "exec" "${screenshot} display") + (key "Backslash" "Super+Shift" "exec" power) + (key "Backspace" "Super" "scroller:alignwindow" "middle") + (key "Backspace" "Super+Shift" "scroller:fitsize" "visible") + (key "Equal" "Super+Shift" "exec" "${zoom} +0.1") (key "Escape" "Super" "pin" null) - (key "Escape" "Super+Alt" "exec" "lifx state --color red") + (key "Escape" "Super+Alt" "exec" "lifx state --color red") (key "Escape" "Super+Shift" "togglefloating" null) - (key "Left" "Super+Ctrl+Shift" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse") - (key "Minus" "Super+Shift" "exec" "${zoom} -0.1") - (key "Return" "Super" "fullscreen" "1") # Maximize - (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen - (key "Slash" "Super" "exec" vrr) - (key "Space" "Ctrl" "exec" dropdown) - (key "Space" "Ctrl+Alt" "exec" "lifx toggle") - (key "Space" "Ctrl+Shift" "exec" pip-toggle) - (key "Space" "Super" "togglespecialworkspace" "scratchpad") - (key "Space" "Super+Ctrl+Shift" "exec" pip-switch) - (key "Space" "Super+Shift" "movetoworkspacesilent" "special:scratchpad") - (key "Tab" "Super" "scroller:toggleoverview" null) + (key "Left" "Super+Ctrl+Shift" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse") + (key "Minus" "Super+Shift" "exec" "${zoom} -0.1") + (key "Return" "Super" "fullscreen" "1") # Maximize + (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen + (key "Slash" "Super" "exec" vrr) + (key "Space" "Ctrl" "exec" dropdown) + (key "Space" "Ctrl+Alt" "exec" "lifx toggle") + (key "Space" "Ctrl+Shift" "exec" pip-toggle) + (key "Space" "Super" "togglespecialworkspace" "scratchpad") + (key "Space" "Super+Ctrl+Shift" "exec" pip-switch) + (key "Space" "Super+Shift" "movetoworkspacesilent" "special:scratchpad") + (key "Tab" "Super" "scroller:toggleoverview" null) - # Alphanumeric keys - (key "0" "Super+Shift" "exec" zoom) - (key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01") - (key "1" "Super" "workspace" "1") - (key "1" "Super+Alt" "exec" "lifx state --kelvin 1500") - (key "1" "Super+Shift" "movetoworkspacesilent" "1") - (key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25") - (key "2" "Super" "workspace" "2") - (key "2" "Super+Alt" "exec" "lifx state --kelvin 2500") - (key "2" "Super+Shift" "movetoworkspacesilent" "2") - (key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50") - (key "3" "Super" "workspace" "3") - (key "3" "Super+Alt" "exec" "lifx state --kelvin 3000") - (key "3" "Super+Shift" "movetoworkspacesilent" "3") - (key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75") - (key "4" "Super" "workspace" "4") - (key "4" "Super+Alt" "exec" "lifx state --kelvin 4000") - (key "4" "Super+Shift" "movetoworkspacesilent" "4") - (key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00") - (key "5" "Super" "workspace" "5") - (key "5" "Super+Alt" "exec" "lifx state --kelvin 5000") - (key "5" "Super+Shift" "movetoworkspacesilent" "5") - (key "6" "Super" "workspace" "6") - (key "6" "Super+Shift" "movetoworkspacesilent" "6") - (key "7" "Super" "workspace" "7") - (key "7" "Super+Shift" "movetoworkspacesilent" "7") - (key "8" "Super" "workspace" "8") - (key "8" "Super+Shift" "movetoworkspacesilent" "8") - (key "9" "Super" "exec" audio) - (key "A" "Ctrl+Alt" "exec" "${waydroid} session stop") - (key "A" "Super" "scroller:movefocus" "l") - (key "A" "Super+Ctrl" "scroller:alignwindow" "left") - (key "A" "Super+Shift" "scroller:movewindow" "l") - (key "B" "Super" "exec" config.custom.browser.command) - (key "C" "Super" "exec" config.custom.menus.clipboard.show) - (key "C" "Super+Shift" "exec" config.custom.menus.clipboard.clear) - (key "D" "Super" "togglespecialworkspace" "android") - (key "D" "Super+Shift" "movetoworkspacesilent" "special:android") + # Alphanumeric keys + (key "0" "Super+Shift" "exec" zoom) + (key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01") + (key "1" "Super" "workspace" "1") + (key "1" "Super+Alt" "exec" "lifx state --kelvin 1500") + (key "1" "Super+Shift" "movetoworkspacesilent" "1") + (key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25") + (key "2" "Super" "workspace" "2") + (key "2" "Super+Alt" "exec" "lifx state --kelvin 2500") + (key "2" "Super+Shift" "movetoworkspacesilent" "2") + (key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50") + (key "3" "Super" "workspace" "3") + (key "3" "Super+Alt" "exec" "lifx state --kelvin 3000") + (key "3" "Super+Shift" "movetoworkspacesilent" "3") + (key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75") + (key "4" "Super" "workspace" "4") + (key "4" "Super+Alt" "exec" "lifx state --kelvin 4000") + (key "4" "Super+Shift" "movetoworkspacesilent" "4") + (key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00") + (key "5" "Super" "workspace" "5") + (key "5" "Super+Alt" "exec" "lifx state --kelvin 5000") + (key "5" "Super+Shift" "movetoworkspacesilent" "5") + (key "6" "Super" "workspace" "6") + (key "6" "Super+Shift" "movetoworkspacesilent" "6") + (key "7" "Super" "workspace" "7") + (key "7" "Super+Shift" "movetoworkspacesilent" "7") + (key "8" "Super" "workspace" "8") + (key "8" "Super+Shift" "movetoworkspacesilent" "8") + (key "9" "Super" "exec" audio) + (key "A" "Ctrl+Alt" "exec" "${waydroid} session stop") + (key "A" "Super" "scroller:movefocus" "l") + (key "A" "Super+Ctrl" "scroller:alignwindow" "left") + (key "A" "Super+Shift" "scroller:movewindow" "l") + (key "B" "Super" "exec" config.custom.browser.command) + (key "C" "Super" "exec" config.custom.menus.clipboard.show) + (key "C" "Super+Shift" "exec" config.custom.menus.clipboard.clear) + (key "D" "Super" "togglespecialworkspace" "android") + (key "D" "Super+Shift" "movetoworkspacesilent" "special:android") (key "E" "Super" "exec" "${gnome-text-editor} --new-window") - (key "F" "Super" "exec" "${nautilus} --new-window") - (key "G" "Super" "togglespecialworkspace" "game") - (key "G" "Super+Ctrl" "exec" steam) - (key "G" "Super+Shift" "movetoworkspacesilent" "special:game") - (key "I" "Super" "exec" codium) - (key "K" "Super" "exec" obsidian) - (key "M" "Super" "togglespecialworkspace" "music") - (key "M" "Super+Shift" "movetoworkspacesilent" "special:music") - (key "O" "Super" "exec" "${hyprpicker} --autocopy") - (key "O" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb") + (key "F" "Super" "exec" "${nautilus} --new-window") + (key "G" "Super" "togglespecialworkspace" "game") + (key "G" "Super+Ctrl" "exec" steam) + (key "G" "Super+Shift" "movetoworkspacesilent" "special:game") + (key "I" "Super" "exec" codium) + (key "K" "Super" "exec" obsidian) + (key "M" "Super" "togglespecialworkspace" "music") + (key "M" "Super+Shift" "movetoworkspacesilent" "special:music") + (key "O" "Super" "exec" "${hyprpicker} --autocopy") + (key "O" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb") (key "P" "Ctrl+Alt" "exec" "${pkill} --exact 1password") - (key "P" "Super" "togglespecialworkspace" "password") - (key "P" "Super+Shift" "movetoworkspacesilent" "special:password") + (key "P" "Super" "togglespecialworkspace" "password") + (key "P" "Super+Shift" "movetoworkspacesilent" "special:password") (key "Q" "Ctrl+Alt" "exec" "${hyprctl} kill") - (key "Q" "Super" "killactive" null) - (key "R" "Super" "scroller:movefocus" "d") - (key "R" "Super+Ctrl" "scroller:alignwindow" "down") - (key "R" "Super+Shift" "scroller:movewindow" "d") + (key "Q" "Super" "killactive" null) + (key "R" "Super" "scroller:movefocus" "d") + (key "R" "Super+Ctrl" "scroller:alignwindow" "down") + (key "R" "Super+Shift" "scroller:movewindow" "d") (key "S" "Ctrl+Alt" "exec" "${pkill} --exact steam") - (key "S" "Super" "scroller:movefocus" "r") - (key "S" "Super+Ctrl" "scroller:alignwindow" "right") - (key "S" "Super+Shift" "scroller:movewindow" "r") + (key "S" "Super" "scroller:movefocus" "r") + (key "S" "Super+Ctrl" "scroller:alignwindow" "right") + (key "S" "Super+Shift" "scroller:movewindow" "r") (key "T" "Ctrl+Alt" "exec" "${pkill} --exact ghostty") - (key "T" "Super" "togglespecialworkspace" "terminal") - (key "T" "Super+Ctrl" "exec" ghostty) - (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal") - (key "V" "Super" "togglespecialworkspace" "vm") - (key "V" "Super+Ctrl" "exec" vm) - (key "V" "Super+Ctrl+Shift" "exec" virt-manager) - (key "V" "Super+Shift" "movetoworkspacesilent" "special:vm") - (key "W" "Super" "scroller:movefocus" "u") - (key "W" "Super+Ctrl" "scroller:alignwindow" "up") - (key "W" "Super+Shift" "scroller:movewindow" "u") + (key "T" "Super" "togglespecialworkspace" "terminal") + (key "T" "Super+Ctrl" "exec" ghostty) + (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal") + (key "V" "Super" "togglespecialworkspace" "vm") + (key "V" "Super+Ctrl" "exec" vm) + (key "V" "Super+Ctrl+Shift" "exec" virt-manager) + (key "V" "Super+Shift" "movetoworkspacesilent" "special:vm") + (key "W" "Super" "scroller:movefocus" "u") + (key "W" "Super+Ctrl" "scroller:alignwindow" "up") + (key "W" "Super+Shift" "scroller:movewindow" "u") (key "X" "Super" "scroller:cyclewidth" "next") (key "X" "Super+Shift" "scroller:cycleheight" "next") (key "Z" "Super" "scroller:cyclewidth" "previous") (key "Z" "Super+Shift" "scroller:cycleheight" "previous") - ]; + ]; - # Lockscreen binds - bindl = [ - (key "Delete" "Ctrl" "exec" "${hyprctl} reload") - (key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions - (key "Delete" "Super" "exec" inhibit) - (key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off") + # Lockscreen binds + bindl = [ + (key "Delete" "Ctrl" "exec" "${hyprctl} reload") + (key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions + (key "Delete" "Super" "exec" inhibit) + (key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off") - # Laptop lid switches - # https://wiki.hyprland.org/Configuring/Binds/#switches - #?? hyprctl devices - #// (key "switch:off:Lid Switch" null "dpms" "on") # Open - #// (key "switch:on:Lid Switch" null "dpms" "off") # Close - ]; + # Laptop lid switches + # https://wiki.hyprland.org/Configuring/Binds/#switches + #?? hyprctl devices + #// (key "switch:off:Lid Switch" null "dpms" "on") # Open + #// (key "switch:on:Lid Switch" null "dpms" "off") # Close + ]; - # Mouse binds - bindm = [ - (key "mouse:272" "Super" "movewindow" null) # LMB - (key "mouse:273" "Super" "resizewindow" null) # RMB - ]; + # Mouse binds + bindm = [ + (key "mouse:272" "Super" "movewindow" null) # LMB + (key "mouse:273" "Super" "resizewindow" null) # RMB + ]; - # Release binds - bindr = [ - (key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper") - (key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper") - (key "Control_L" "Super+Ctrl" "scroller:admitwindow" null) - (key "Control_L" "Super+Ctrl+Shift" "scroller:expelwindow" null) + # Release binds + bindr = [ + (key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper") + (key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper") + (key "Control_L" "Super+Ctrl" "scroller:admitwindow" null) + (key "Control_L" "Super+Ctrl+Shift" "scroller:expelwindow" null) # BUG: Causes Hyprland to crash when floating the scroller:pin window (key "Shift_L" "Super+Shift" "scroller:pin" null) (key "Super_L" "Super" "exec" config.custom.menus.default.show) - (key "Super_L" "Super+Alt" "exec" config.custom.menus.vault.show) - (key "Super_L" "Super+Ctrl+Shift" "exec" config.custom.menus.network.show) - (key "Super_L" "Super+Shift" "exec" config.custom.menus.search.show) - ]; - }; - }; + (key "Super_L" "Super+Alt" "exec" config.custom.menus.vault.show) + (key "Super_L" "Super+Ctrl+Shift" "exec" config.custom.menus.network.show) + (key "Super_L" "Super+Shift" "exec" config.custom.menus.search.show) + ]; + }; + } + ]; }; } diff --git a/options/custom/desktops/hyprland/default.nix b/options/custom/desktops/hyprland/default.nix index f15b574..7ebcbfd 100644 --- a/options/custom/desktops/hyprland/default.nix +++ b/options/custom/desktops/hyprland/default.nix @@ -13,7 +13,8 @@ in { }; config = mkIf cfg.enable { - custom.desktops = mkIf config.custom.full { + custom = { + desktops = mkIf config.custom.full { hyprland = { binds.enable = true; keywords.enable = true; @@ -29,11 +30,20 @@ in { }; }; + programs = { + uwsm.enable = true; + }; + }; + # https://wiki.hyprland.org # https://github.com/hyprwm/Hyprland programs.hyprland = { enable = true; package = hm.wayland.windowManager.hyprland.finalPackage; + + # BUG: Some apps launched via exec cause session to end, wrap in uwsm to isolate scope + # https://github.com/Vladimir-csp/uwsm/issues/45 + #?? uwsm app -- COMMAND withUWSM = true; }; diff --git a/options/custom/desktops/hyprland/keywords.nix b/options/custom/desktops/hyprland/keywords.nix index 3abad8b..d31047c 100644 --- a/options/custom/desktops/hyprland/keywords.nix +++ b/options/custom/desktops/hyprland/keywords.nix @@ -15,7 +15,10 @@ with lib; let modprobe = getExe' pkgs.kmod "modprobe"; nautilus = getExe pkgs.nautilus; sway-audio-idle-inhibit = getExe pkgs.sway-audio-idle-inhibit; + uwsm = getExe pkgs.uwsm; virsh = getExe' config.virtualisation.libvirtd.package "virsh"; + + command = command: "${uwsm} app -- ${command}"; in { options.custom.desktops.hyprland.keywords = { enable = mkOption {default = false;}; @@ -87,26 +90,25 @@ in { # https://wiki.hyprland.org/Configuring/Keywords/#executing exec = [ - "${left} --init --scroll kensington-orbit-wireless-tb-mouse" # Enforce left-pawed state + (command "${left} --init --scroll kensington-orbit-wireless-tb-mouse") # Enforce left-pawed state ]; - # https://wiki.hyprland.org/Configuring/Keywords/#executing exec-once = [ - sway-audio-idle-inhibit # Inhibit idle while audio is playing - "${audio} --init" # Enforce audio profile state - config.custom.menus.clipboard.clear-silent # Clear clipboard history + (command sway-audio-idle-inhibit) # Inhibit idle while audio is playing + (command "${audio} --init") # Enforce audio profile state + (command config.custom.menus.clipboard.clear-silent) # Clear clipboard history # HACK: Launch hidden GTK windows to reduce startup time - "[workspace special:hidden silent] ${loupe}" - "[workspace special:hidden silent] ${nautilus}" + "[workspace special:hidden silent] ${command loupe}" + "[workspace special:hidden silent] ${command nautilus}" ] ++ optionals config.custom.wallpaper [ - "wallpaper" + (command wallpaper) ] - # HACK: Delay driver initialization to work around reset issues ++ optionals config.custom.settings.vm.passthrough.blacklist [ - "${virsh} list | ${grep} ${config.custom.settings.vm.passthrough.guest} || sudo ${modprobe} ${config.custom.settings.vm.passthrough.driver}" + # HACK: Delay driver initialization to work around reset issues + (command "${virsh} list | ${grep} ${config.custom.settings.vm.passthrough.guest} || sudo ${modprobe} ${config.custom.settings.vm.passthrough.driver}") ]; }; } diff --git a/options/custom/desktops/hyprland/plugins.nix b/options/custom/desktops/hyprland/plugins.nix index d9c841e..aff4ac0 100644 --- a/options/custom/desktops/hyprland/plugins.nix +++ b/options/custom/desktops/hyprland/plugins.nix @@ -8,6 +8,9 @@ with lib; let cfg = config.custom.desktops.hyprland.plugins; hyprctl = getExe' config.programs.hyprland.package "hyprctl"; + uwsm = getExe pkgs.uwsm; + + command = command: "${uwsm} app -- ${command}"; in { options.custom.desktops.hyprland.plugins = { enable = mkOption {default = false;}; @@ -47,9 +50,9 @@ in { # https://github.com/hyprwm/hyprland-plugins/tree/main/hyprbars#buttons-config #?? hyprbars-button = COLOR, SIZE, ICON, EXEC hyprbars-button = [ - "rgb(dc322f), 16,, ${hyprctl} dispatch killactive" # Close - "rgb(d33682), 16,, ${hyprctl} dispatch fullscreen 1" # Maximize - "rgb(6c71c4), 16,, minimize" # Minimize + "rgb(dc322f), 16,, ${command "${hyprctl} dispatch killactive"}" # Close + "rgb(d33682), 16,, ${command "${hyprctl} dispatch fullscreen 1"}" # Maximize + "rgb(6c71c4), 16,, ${command minimize}" # Minimize ]; }; diff --git a/options/custom/desktops/hyprland/rules.nix b/options/custom/desktops/hyprland/rules.nix index b8180ac..1ddf6a8 100644 --- a/options/custom/desktops/hyprland/rules.nix +++ b/options/custom/desktops/hyprland/rules.nix @@ -15,8 +15,11 @@ with lib; let libreoffice = getExe config.custom.programs.libreoffice.package; loupe = getExe pkgs.loupe; steam = getExe config.programs.steam.package; + uwsm = getExe pkgs.uwsm; virt-manager = getExe pkgs.virt-manager; waydroid = getExe pkgs.waydroid; + + command = command: "${uwsm} app -- ${command}"; youtube-music = getExe pkgs.youtube-music; in { options.custom.desktops.hyprland.rules = { @@ -30,14 +33,14 @@ in { # https://wiki.hyprland.org/Configuring/Workspace-Rules #?? workspace = WORKSPACE, RULES workspace = [ - "special:android, on-created-empty:${launch} --workspace special:android --empty ${waydroid} app launch com.YoStarEN.Arknights" - "special:game, on-created-empty:${steam}" - "special:music, on-created-empty:${youtube-music}" - "special:office, on-created-empty:${launch} --workspace special:office --empty --tile -- ${libreoffice}" - "special:password, on-created-empty:${launch} --workspace special:password --empty ${_1password}" - "special:terminal, on-created-empty:${ghostty}" - "special:vm, on-created-empty:${launch} --workspace special:vm --empty ${virt-manager}" - "special:wallpaper, on-created-empty:${loupe} /tmp/wallpaper.png" + "special:android, on-created-empty:${command "${launch} --workspace special:android --empty ${waydroid} app launch com.YoStarEN.Arknights"}" + "special:game, on-created-empty:${command steam}" + "special:music, on-created-empty:${command youtube-music}" + "special:office, on-created-empty:${command "${launch} --workspace special:office --empty --tile -- ${libreoffice}"}" + "special:password, on-created-empty:${command "${launch} --workspace special:password --empty ${_1password}"}" + "special:terminal, on-created-empty:${command ghostty}" + "special:vm, on-created-empty:${command "${launch} --workspace special:vm --empty ${virt-manager}"}" + "special:wallpaper, on-created-empty:${command "${loupe} /tmp/wallpaper.png"}" ]; # https://wiki.hyprland.org/Configuring/Window-Rules