1
1
Fork 0

hyprland: use uwsm to isolate exec scope

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2025-02-15 15:59:54 -06:00
parent a691050bc4
commit 6cde225c08
Signed by: Myned
GPG key ID: C7224454F7881A34
5 changed files with 238 additions and 212 deletions

View file

@ -17,9 +17,6 @@ with lib; let
hyprlock = getExe hm.programs.hyprlock.package; hyprlock = getExe hm.programs.hyprlock.package;
hyprpicker = getExe pkgs.hyprpicker; hyprpicker = getExe pkgs.hyprpicker;
inhibit = hm.home.file.".local/bin/inhibit".source; 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; left = hm.home.file.".local/bin/left".source;
loginctl = getExe' pkgs.systemd "loginctl"; loginctl = getExe' pkgs.systemd "loginctl";
nautilus = getExe pkgs.nautilus; nautilus = getExe pkgs.nautilus;
@ -34,234 +31,245 @@ with lib; let
steam = getExe config.programs.steam.package; steam = getExe config.programs.steam.package;
swayosd-client = getExe' pkgs.swayosd "swayosd-client"; swayosd-client = getExe' pkgs.swayosd "swayosd-client";
toggle = hm.home.file.".local/bin/toggle".source; toggle = hm.home.file.".local/bin/toggle".source;
uwsm = getExe pkgs.uwsm;
virt-manager = getExe config.programs.virt-manager.package; virt-manager = getExe config.programs.virt-manager.package;
vrr = hm.home.file.".local/bin/vrr".source; vrr = hm.home.file.".local/bin/vrr".source;
waydroid = getExe pkgs.waydroid; waydroid = getExe pkgs.waydroid;
window = hm.home.file.".local/bin/window".source; window = hm.home.file.".local/bin/window".source;
zoom = hm.home.file.".local/bin/zoom".source; zoom = hm.home.file.".local/bin/zoom".source;
command = command: "${uwsm} app -- ${command}";
in { in {
options.custom.desktops.hyprland.binds.enable = mkOption {default = false;}; options.custom.desktops.hyprland.binds = {
enable = mkOption {default = false;};
};
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.${config.custom.username} = { home-manager.sharedModules = [
wayland.windowManager.hyprland.settings = let {
# Reverse mods and key for alphabetical sorting wayland.windowManager.hyprland.settings = let
#?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null> # Reverse mods and key for alphabetical sorting
key = key: mods: dispatcher: params: "${ #?? key <"KEY"> <"MODS"|null> <"DISPATCHER"> <"PARAMS"|null>
if (isNull mods) key = key: mods: dispatcher: params: "${
then "" if (isNull mods)
else mods then ""
}, ${key}, ${dispatcher}${ else mods
if (isNull params) }, ${key}, ${dispatcher}${
then "" if (isNull params)
else ", ${params}" then ""
}"; else ", ${
if dispatcher == "exec"
then command params
else params
}"
}";
dropdown = concatStringsSep " " [ dropdown = concatStringsSep " " [
"${toggle}" "${toggle}"
"--focus" "--focus"
"--type class" "--type class"
"--expression '^.*dropdown$'" "--expression '^.*dropdown$'"
"--workspace special:dropdown" "--workspace special:dropdown"
"--" "--"
#!! Must be valid GTK class #!! Must be valid GTK class
# https://github.com/ghostty-org/ghostty/issues/3336 # https://github.com/ghostty-org/ghostty/issues/3336
"${ghostty} --class=gtk.dropdown" "${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 " " [ pip-switch = with config.custom;
"${toggle}" concatStringsSep " " [
"--type title" "${window} move"
"--expression '^Picture.in.[Pp]icture$'" "--current"
"--workspace special:pip" "--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})" ${ pip-toggle = concatStringsSep " " [
if config.custom.hidpi "${toggle}"
then "--scale 140" "--type title"
else "" "--expression '^Picture.in.[Pp]icture$'"
} myndows''; "--workspace special:pip"
in { ];
# https://wiki.hyprland.org/Configuring/Binds
#?? bind = MODS, KEY, DISPATCHER, [PARAMS]
#?? wev
# Regular binds vm = ''${remote} --vm --client xfreerdp --username Myned --password "$(${cat} ${config.age.secrets."desktop/vm/myndows.pass".path})" ${
bind = []; if config.custom.hidpi
then "--scale 140"
else ""
} myndows'';
in {
# https://wiki.hyprland.org/Configuring/Binds
#?? bind = MODS, KEY, DISPATCHER, [PARAMS]
#?? wev
# Repeat binds # Regular binds
binde = [ bind = [];
# 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
# Meta alternatives # Repeat binds
(key "0" "Super" "exec" "${swayosd-client} --output-volume mute-toggle") binde = [
(key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower") # Media keys
(key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise") # https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
(key "Left" "Super" "exec" "${playerctl} previous") (key "XF86AudioMute" null "exec" "${swayosd-client} --output-volume mute-toggle") # F1
(key "Delete" "Super" "exec" "${playerctl} play-pause") (key "XF86AudioLowerVolume" null "exec" "${swayosd-client} --output-volume lower") # F2
(key "Right" "Super" "exec" "${playerctl} next") (key "XF86AudioRaiseVolume" null "exec" "${swayosd-client} --output-volume raise") # F3
(key "Down" "Super" "exec" "${swayosd-client} --brightness lower") (key "XF86AudioPrev" null "exec" "${playerctl} previous") # F4
(key "Up" "Super" "exec" "${swayosd-client} --brightness raise") (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 # Meta alternatives
(key "Apostrophe" "Super" "exec" "${screenshot} selection") (key "0" "Super" "exec" "${swayosd-client} --output-volume mute-toggle")
(key "Apostrophe" "Super+Alt" "exec" "${screenshot} selection --edit") (key "Minus" "Super" "exec" "${swayosd-client} --output-volume lower")
(key "Apostrophe" "Super+Alt+Shift" "exec" "${screenshot} display --edit") (key "Equal" "Super" "exec" "${swayosd-client} --output-volume raise")
(key "Apostrophe" "Super+Shift" "exec" "${screenshot} display") (key "Left" "Super" "exec" "${playerctl} previous")
(key "Backslash" "Super+Shift" "exec" power) (key "Delete" "Super" "exec" "${playerctl} play-pause")
(key "Backspace" "Super" "scroller:alignwindow" "middle") (key "Right" "Super" "exec" "${playerctl} next")
(key "Backspace" "Super+Shift" "scroller:fitsize" "visible") (key "Down" "Super" "exec" "${swayosd-client} --brightness lower")
(key "Equal" "Super+Shift" "exec" "${zoom} +0.1") (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" "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 "Escape" "Super+Shift" "togglefloating" null)
(key "Left" "Super+Ctrl+Shift" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse") (key "Left" "Super+Ctrl+Shift" "exec" "${left} --scroll kensington-orbit-wireless-tb-mouse")
(key "Minus" "Super+Shift" "exec" "${zoom} -0.1") (key "Minus" "Super+Shift" "exec" "${zoom} -0.1")
(key "Return" "Super" "fullscreen" "1") # Maximize (key "Return" "Super" "fullscreen" "1") # Maximize
(key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen (key "Return" "Super+Shift" "fullscreen" "0") # Fullscreen
(key "Slash" "Super" "exec" vrr) (key "Slash" "Super" "exec" vrr)
(key "Space" "Ctrl" "exec" dropdown) (key "Space" "Ctrl" "exec" dropdown)
(key "Space" "Ctrl+Alt" "exec" "lifx toggle") (key "Space" "Ctrl+Alt" "exec" "lifx toggle")
(key "Space" "Ctrl+Shift" "exec" pip-toggle) (key "Space" "Ctrl+Shift" "exec" pip-toggle)
(key "Space" "Super" "togglespecialworkspace" "scratchpad") (key "Space" "Super" "togglespecialworkspace" "scratchpad")
(key "Space" "Super+Ctrl+Shift" "exec" pip-switch) (key "Space" "Super+Ctrl+Shift" "exec" pip-switch)
(key "Space" "Super+Shift" "movetoworkspacesilent" "special:scratchpad") (key "Space" "Super+Shift" "movetoworkspacesilent" "special:scratchpad")
(key "Tab" "Super" "scroller:toggleoverview" null) (key "Tab" "Super" "scroller:toggleoverview" null)
# Alphanumeric keys # Alphanumeric keys
(key "0" "Super+Shift" "exec" zoom) (key "0" "Super+Shift" "exec" zoom)
(key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01") (key "1" "Ctrl+Alt" "exec" "lifx state --brightness 0.01")
(key "1" "Super" "workspace" "1") (key "1" "Super" "workspace" "1")
(key "1" "Super+Alt" "exec" "lifx state --kelvin 1500") (key "1" "Super+Alt" "exec" "lifx state --kelvin 1500")
(key "1" "Super+Shift" "movetoworkspacesilent" "1") (key "1" "Super+Shift" "movetoworkspacesilent" "1")
(key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25") (key "2" "Ctrl+Alt" "exec" "lifx state --brightness 0.25")
(key "2" "Super" "workspace" "2") (key "2" "Super" "workspace" "2")
(key "2" "Super+Alt" "exec" "lifx state --kelvin 2500") (key "2" "Super+Alt" "exec" "lifx state --kelvin 2500")
(key "2" "Super+Shift" "movetoworkspacesilent" "2") (key "2" "Super+Shift" "movetoworkspacesilent" "2")
(key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50") (key "3" "Ctrl+Alt" "exec" "lifx state --brightness 0.50")
(key "3" "Super" "workspace" "3") (key "3" "Super" "workspace" "3")
(key "3" "Super+Alt" "exec" "lifx state --kelvin 3000") (key "3" "Super+Alt" "exec" "lifx state --kelvin 3000")
(key "3" "Super+Shift" "movetoworkspacesilent" "3") (key "3" "Super+Shift" "movetoworkspacesilent" "3")
(key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75") (key "4" "Ctrl+Alt" "exec" "lifx state --brightness 0.75")
(key "4" "Super" "workspace" "4") (key "4" "Super" "workspace" "4")
(key "4" "Super+Alt" "exec" "lifx state --kelvin 4000") (key "4" "Super+Alt" "exec" "lifx state --kelvin 4000")
(key "4" "Super+Shift" "movetoworkspacesilent" "4") (key "4" "Super+Shift" "movetoworkspacesilent" "4")
(key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00") (key "5" "Ctrl+Alt" "exec" "lifx state --brightness 1.00")
(key "5" "Super" "workspace" "5") (key "5" "Super" "workspace" "5")
(key "5" "Super+Alt" "exec" "lifx state --kelvin 5000") (key "5" "Super+Alt" "exec" "lifx state --kelvin 5000")
(key "5" "Super+Shift" "movetoworkspacesilent" "5") (key "5" "Super+Shift" "movetoworkspacesilent" "5")
(key "6" "Super" "workspace" "6") (key "6" "Super" "workspace" "6")
(key "6" "Super+Shift" "movetoworkspacesilent" "6") (key "6" "Super+Shift" "movetoworkspacesilent" "6")
(key "7" "Super" "workspace" "7") (key "7" "Super" "workspace" "7")
(key "7" "Super+Shift" "movetoworkspacesilent" "7") (key "7" "Super+Shift" "movetoworkspacesilent" "7")
(key "8" "Super" "workspace" "8") (key "8" "Super" "workspace" "8")
(key "8" "Super+Shift" "movetoworkspacesilent" "8") (key "8" "Super+Shift" "movetoworkspacesilent" "8")
(key "9" "Super" "exec" audio) (key "9" "Super" "exec" audio)
(key "A" "Ctrl+Alt" "exec" "${waydroid} session stop") (key "A" "Ctrl+Alt" "exec" "${waydroid} session stop")
(key "A" "Super" "scroller:movefocus" "l") (key "A" "Super" "scroller:movefocus" "l")
(key "A" "Super+Ctrl" "scroller:alignwindow" "left") (key "A" "Super+Ctrl" "scroller:alignwindow" "left")
(key "A" "Super+Shift" "scroller:movewindow" "l") (key "A" "Super+Shift" "scroller:movewindow" "l")
(key "B" "Super" "exec" config.custom.browser.command) (key "B" "Super" "exec" config.custom.browser.command)
(key "C" "Super" "exec" config.custom.menus.clipboard.show) (key "C" "Super" "exec" config.custom.menus.clipboard.show)
(key "C" "Super+Shift" "exec" config.custom.menus.clipboard.clear) (key "C" "Super+Shift" "exec" config.custom.menus.clipboard.clear)
(key "D" "Super" "togglespecialworkspace" "android") (key "D" "Super" "togglespecialworkspace" "android")
(key "D" "Super+Shift" "movetoworkspacesilent" "special:android") (key "D" "Super+Shift" "movetoworkspacesilent" "special:android")
(key "E" "Super" "exec" "${gnome-text-editor} --new-window") (key "E" "Super" "exec" "${gnome-text-editor} --new-window")
(key "F" "Super" "exec" "${nautilus} --new-window") (key "F" "Super" "exec" "${nautilus} --new-window")
(key "G" "Super" "togglespecialworkspace" "game") (key "G" "Super" "togglespecialworkspace" "game")
(key "G" "Super+Ctrl" "exec" steam) (key "G" "Super+Ctrl" "exec" steam)
(key "G" "Super+Shift" "movetoworkspacesilent" "special:game") (key "G" "Super+Shift" "movetoworkspacesilent" "special:game")
(key "I" "Super" "exec" codium) (key "I" "Super" "exec" codium)
(key "K" "Super" "exec" obsidian) (key "K" "Super" "exec" obsidian)
(key "M" "Super" "togglespecialworkspace" "music") (key "M" "Super" "togglespecialworkspace" "music")
(key "M" "Super+Shift" "movetoworkspacesilent" "special:music") (key "M" "Super+Shift" "movetoworkspacesilent" "special:music")
(key "O" "Super" "exec" "${hyprpicker} --autocopy") (key "O" "Super" "exec" "${hyprpicker} --autocopy")
(key "O" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb") (key "O" "Super+Shift" "exec" "${hyprpicker} --autocopy --format rgb")
(key "P" "Ctrl+Alt" "exec" "${pkill} --exact 1password") (key "P" "Ctrl+Alt" "exec" "${pkill} --exact 1password")
(key "P" "Super" "togglespecialworkspace" "password") (key "P" "Super" "togglespecialworkspace" "password")
(key "P" "Super+Shift" "movetoworkspacesilent" "special:password") (key "P" "Super+Shift" "movetoworkspacesilent" "special:password")
(key "Q" "Ctrl+Alt" "exec" "${hyprctl} kill") (key "Q" "Ctrl+Alt" "exec" "${hyprctl} kill")
(key "Q" "Super" "killactive" null) (key "Q" "Super" "killactive" null)
(key "R" "Super" "scroller:movefocus" "d") (key "R" "Super" "scroller:movefocus" "d")
(key "R" "Super+Ctrl" "scroller:alignwindow" "down") (key "R" "Super+Ctrl" "scroller:alignwindow" "down")
(key "R" "Super+Shift" "scroller:movewindow" "d") (key "R" "Super+Shift" "scroller:movewindow" "d")
(key "S" "Ctrl+Alt" "exec" "${pkill} --exact steam") (key "S" "Ctrl+Alt" "exec" "${pkill} --exact steam")
(key "S" "Super" "scroller:movefocus" "r") (key "S" "Super" "scroller:movefocus" "r")
(key "S" "Super+Ctrl" "scroller:alignwindow" "right") (key "S" "Super+Ctrl" "scroller:alignwindow" "right")
(key "S" "Super+Shift" "scroller:movewindow" "r") (key "S" "Super+Shift" "scroller:movewindow" "r")
(key "T" "Ctrl+Alt" "exec" "${pkill} --exact ghostty") (key "T" "Ctrl+Alt" "exec" "${pkill} --exact ghostty")
(key "T" "Super" "togglespecialworkspace" "terminal") (key "T" "Super" "togglespecialworkspace" "terminal")
(key "T" "Super+Ctrl" "exec" ghostty) (key "T" "Super+Ctrl" "exec" ghostty)
(key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal") (key "T" "Super+Shift" "movetoworkspacesilent" "special:terminal")
(key "V" "Super" "togglespecialworkspace" "vm") (key "V" "Super" "togglespecialworkspace" "vm")
(key "V" "Super+Ctrl" "exec" vm) (key "V" "Super+Ctrl" "exec" vm)
(key "V" "Super+Ctrl+Shift" "exec" virt-manager) (key "V" "Super+Ctrl+Shift" "exec" virt-manager)
(key "V" "Super+Shift" "movetoworkspacesilent" "special:vm") (key "V" "Super+Shift" "movetoworkspacesilent" "special:vm")
(key "W" "Super" "scroller:movefocus" "u") (key "W" "Super" "scroller:movefocus" "u")
(key "W" "Super+Ctrl" "scroller:alignwindow" "up") (key "W" "Super+Ctrl" "scroller:alignwindow" "up")
(key "W" "Super+Shift" "scroller:movewindow" "u") (key "W" "Super+Shift" "scroller:movewindow" "u")
(key "X" "Super" "scroller:cyclewidth" "next") (key "X" "Super" "scroller:cyclewidth" "next")
(key "X" "Super+Shift" "scroller:cycleheight" "next") (key "X" "Super+Shift" "scroller:cycleheight" "next")
(key "Z" "Super" "scroller:cyclewidth" "previous") (key "Z" "Super" "scroller:cyclewidth" "previous")
(key "Z" "Super+Shift" "scroller:cycleheight" "previous") (key "Z" "Super+Shift" "scroller:cycleheight" "previous")
]; ];
# Lockscreen binds # Lockscreen binds
bindl = [ bindl = [
(key "Delete" "Ctrl" "exec" "${hyprctl} reload") (key "Delete" "Ctrl" "exec" "${hyprctl} reload")
(key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions (key "Delete" "Ctrl+Alt" "exec" "${loginctl} terminate-user ''") # Current user sessions
(key "Delete" "Super" "exec" inhibit) (key "Delete" "Super" "exec" inhibit)
(key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off") (key "L" "Super" "exec" "${hyprlock} --immediate & ${sleep} 1 && ${hyprctl} dispatch dpms off")
# Laptop lid switches # Laptop lid switches
# https://wiki.hyprland.org/Configuring/Binds/#switches # https://wiki.hyprland.org/Configuring/Binds/#switches
#?? hyprctl devices #?? hyprctl devices
#// (key "switch:off:Lid Switch" null "dpms" "on") # Open #// (key "switch:off:Lid Switch" null "dpms" "on") # Open
#// (key "switch:on:Lid Switch" null "dpms" "off") # Close #// (key "switch:on:Lid Switch" null "dpms" "off") # Close
]; ];
# Mouse binds # Mouse binds
bindm = [ bindm = [
(key "mouse:272" "Super" "movewindow" null) # LMB (key "mouse:272" "Super" "movewindow" null) # LMB
(key "mouse:273" "Super" "resizewindow" null) # RMB (key "mouse:273" "Super" "resizewindow" null) # RMB
]; ];
# Release binds # Release binds
bindr = [ bindr = [
(key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper") (key "Alt_L" "Super+Alt" "togglespecialworkspace" "wallpaper")
(key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper") (key "Alt_L" "Super+Alt+Shift" "movetoworkspacesilent" "special:wallpaper")
(key "Control_L" "Super+Ctrl" "scroller:admitwindow" null) (key "Control_L" "Super+Ctrl" "scroller:admitwindow" null)
(key "Control_L" "Super+Ctrl+Shift" "scroller:expelwindow" null) (key "Control_L" "Super+Ctrl+Shift" "scroller:expelwindow" null)
# BUG: Causes Hyprland to crash when floating the scroller:pin window # BUG: Causes Hyprland to crash when floating the scroller:pin window
(key "Shift_L" "Super+Shift" "scroller:pin" null) (key "Shift_L" "Super+Shift" "scroller:pin" null)
(key "Super_L" "Super" "exec" config.custom.menus.default.show) (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+Alt" "exec" config.custom.menus.vault.show)
(key "Super_L" "Super+Ctrl+Shift" "exec" config.custom.menus.network.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+Shift" "exec" config.custom.menus.search.show)
]; ];
}; };
}; }
];
}; };
} }

View file

@ -13,7 +13,8 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
custom.desktops = mkIf config.custom.full { custom = {
desktops = mkIf config.custom.full {
hyprland = { hyprland = {
binds.enable = true; binds.enable = true;
keywords.enable = true; keywords.enable = true;
@ -29,11 +30,20 @@ in {
}; };
}; };
programs = {
uwsm.enable = true;
};
};
# https://wiki.hyprland.org # https://wiki.hyprland.org
# https://github.com/hyprwm/Hyprland # https://github.com/hyprwm/Hyprland
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
package = hm.wayland.windowManager.hyprland.finalPackage; 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; withUWSM = true;
}; };

View file

@ -15,7 +15,10 @@ with lib; let
modprobe = getExe' pkgs.kmod "modprobe"; modprobe = getExe' pkgs.kmod "modprobe";
nautilus = getExe pkgs.nautilus; nautilus = getExe pkgs.nautilus;
sway-audio-idle-inhibit = getExe pkgs.sway-audio-idle-inhibit; sway-audio-idle-inhibit = getExe pkgs.sway-audio-idle-inhibit;
uwsm = getExe pkgs.uwsm;
virsh = getExe' config.virtualisation.libvirtd.package "virsh"; virsh = getExe' config.virtualisation.libvirtd.package "virsh";
command = command: "${uwsm} app -- ${command}";
in { in {
options.custom.desktops.hyprland.keywords = { options.custom.desktops.hyprland.keywords = {
enable = mkOption {default = false;}; enable = mkOption {default = false;};
@ -87,26 +90,25 @@ in {
# https://wiki.hyprland.org/Configuring/Keywords/#executing # https://wiki.hyprland.org/Configuring/Keywords/#executing
exec = [ 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 = exec-once =
[ [
sway-audio-idle-inhibit # Inhibit idle while audio is playing (command sway-audio-idle-inhibit) # Inhibit idle while audio is playing
"${audio} --init" # Enforce audio profile state (command "${audio} --init") # Enforce audio profile state
config.custom.menus.clipboard.clear-silent # Clear clipboard history (command config.custom.menus.clipboard.clear-silent) # Clear clipboard history
# HACK: Launch hidden GTK windows to reduce startup time # HACK: Launch hidden GTK windows to reduce startup time
"[workspace special:hidden silent] ${loupe}" "[workspace special:hidden silent] ${command loupe}"
"[workspace special:hidden silent] ${nautilus}" "[workspace special:hidden silent] ${command nautilus}"
] ]
++ optionals config.custom.wallpaper [ ++ optionals config.custom.wallpaper [
"wallpaper" (command wallpaper)
] ]
# HACK: Delay driver initialization to work around reset issues
++ optionals config.custom.settings.vm.passthrough.blacklist [ ++ 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}")
]; ];
}; };
} }

View file

@ -8,6 +8,9 @@ with lib; let
cfg = config.custom.desktops.hyprland.plugins; cfg = config.custom.desktops.hyprland.plugins;
hyprctl = getExe' config.programs.hyprland.package "hyprctl"; hyprctl = getExe' config.programs.hyprland.package "hyprctl";
uwsm = getExe pkgs.uwsm;
command = command: "${uwsm} app -- ${command}";
in { in {
options.custom.desktops.hyprland.plugins = { options.custom.desktops.hyprland.plugins = {
enable = mkOption {default = false;}; enable = mkOption {default = false;};
@ -47,9 +50,9 @@ in {
# https://github.com/hyprwm/hyprland-plugins/tree/main/hyprbars#buttons-config # https://github.com/hyprwm/hyprland-plugins/tree/main/hyprbars#buttons-config
#?? hyprbars-button = COLOR, SIZE, ICON, EXEC #?? hyprbars-button = COLOR, SIZE, ICON, EXEC
hyprbars-button = [ hyprbars-button = [
"rgb(dc322f), 16,, ${hyprctl} dispatch killactive" # Close "rgb(dc322f), 16,, ${command "${hyprctl} dispatch killactive"}" # Close
"rgb(d33682), 16,, ${hyprctl} dispatch fullscreen 1" # Maximize "rgb(d33682), 16,, ${command "${hyprctl} dispatch fullscreen 1"}" # Maximize
"rgb(6c71c4), 16,, minimize" # Minimize "rgb(6c71c4), 16,, ${command minimize}" # Minimize
]; ];
}; };

View file

@ -15,8 +15,11 @@ with lib; let
libreoffice = getExe config.custom.programs.libreoffice.package; libreoffice = getExe config.custom.programs.libreoffice.package;
loupe = getExe pkgs.loupe; loupe = getExe pkgs.loupe;
steam = getExe config.programs.steam.package; steam = getExe config.programs.steam.package;
uwsm = getExe pkgs.uwsm;
virt-manager = getExe pkgs.virt-manager; virt-manager = getExe pkgs.virt-manager;
waydroid = getExe pkgs.waydroid; waydroid = getExe pkgs.waydroid;
command = command: "${uwsm} app -- ${command}";
youtube-music = getExe pkgs.youtube-music; youtube-music = getExe pkgs.youtube-music;
in { in {
options.custom.desktops.hyprland.rules = { options.custom.desktops.hyprland.rules = {
@ -30,14 +33,14 @@ in {
# https://wiki.hyprland.org/Configuring/Workspace-Rules # https://wiki.hyprland.org/Configuring/Workspace-Rules
#?? workspace = WORKSPACE, RULES #?? workspace = WORKSPACE, RULES
workspace = [ workspace = [
"special:android, on-created-empty:${launch} --workspace special:android --empty ${waydroid} app launch com.YoStarEN.Arknights" "special:android, on-created-empty:${command "${launch} --workspace special:android --empty ${waydroid} app launch com.YoStarEN.Arknights"}"
"special:game, on-created-empty:${steam}" "special:game, on-created-empty:${command steam}"
"special:music, on-created-empty:${youtube-music}" "special:music, on-created-empty:${command youtube-music}"
"special:office, on-created-empty:${launch} --workspace special:office --empty --tile -- ${libreoffice}" "special:office, on-created-empty:${command "${launch} --workspace special:office --empty --tile -- ${libreoffice}"}"
"special:password, on-created-empty:${launch} --workspace special:password --empty ${_1password}" "special:password, on-created-empty:${command "${launch} --workspace special:password --empty ${_1password}"}"
"special:terminal, on-created-empty:${ghostty}" "special:terminal, on-created-empty:${command ghostty}"
"special:vm, on-created-empty:${launch} --workspace special:vm --empty ${virt-manager}" "special:vm, on-created-empty:${command "${launch} --workspace special:vm --empty ${virt-manager}"}"
"special:wallpaper, on-created-empty:${loupe} /tmp/wallpaper.png" "special:wallpaper, on-created-empty:${command "${loupe} /tmp/wallpaper.png"}"
]; ];
# https://wiki.hyprland.org/Configuring/Window-Rules # https://wiki.hyprland.org/Configuring/Window-Rules