Files
nixos/packages/hyprland/config/binds.nix
T
kenji 2cbe32f561 t
2025-07-31 06:41:23 -05:00

301 lines
11 KiB
Nix

{
config,
pkgs,
...
}: {
wayland.windowManager.hyprland.settings = {
exec = [
"hyprctl dispatch submap global"
];
submap = [
"global"
];
# Shell keybinds
bindi = [
"$mod, Super_L, global, caelestia:launcher" # bind to `bind` because `bindi` maps to it
# Launcher
];
bindin =
[
"$mod, catchall, global, caelestia:launcherInterrupt"
"$mod, mouse:272, global, caelestia:launcherInterrupt"
"$mod, mouse:273, global, caelestia:launcherInterrupt"
"$mod, mouse:274, global, caelestia:launcherInterrupt"
"$mod, mouse:275, global, caelestia:launcherInterrupt"
"$mod, mouse:276, global, caelestia:launcherInterrupt"
"$mod, mouse:277, global, caelestia:launcherInterrupt"
"$mod, mouse_up, global, caelestia:launcherInterrupt"
"$mod, mouse_down, global, caelestia:launcherInterrupt"
"$mod, K, global, caelestia:launcherInterrupt"
"$mod, H, global, caelestia:launcherInterrupt"
"$mod, J, global, caelestia:launcherInterrupt"
"$mod, L, global, caelestia:launcherInterrupt"
"$mod, S, global, caelestia:launcherInterrupt"
"$mod, G, global, caelestia:launcherInterrupt"
"$mod, T, global, caelestia:launcherInterrupt"
"$mod, D, global, caelestia:launcherInterrupt"
"$mod, Escape, global, caelestia:launcherInterrupt"
"$mod, PERIOD, global, caelestia:launcherInterrupt"
"$mod, SPACE, global, caelestia:launcherInterrupt"
"$mod, E, global, caelestia:launcherInterrupt"
"$mod, V, global, caelestia:launcherInterrupt"
"$mod, W, global, caelestia:launcherInterrupt"
"$mod, Q, global, caelestia:launcherInterrupt"
"$mod, C, global, caelestia:launcherInterrupt"
"$mod, Return, global, caelestia:launcherInterrupt"
]
++ (
# Go to workspace group #
builtins.concatLists (builtins.genList (
i: let
ws = i + 1;
in [
"$mod, ${toString ws}, global, caelestia:launcherInterrupt"
]
)
9)
)
++ [
"$mod, 0, global, caelestia:launcherInterrupt"
];
bind =
[
# Misc
"Control+Alt, Delete, exec, caelestia:session"
"$mod ALT, A, global, caelestia:showall"
"$mod ALT, L, global, caelestia:lock"
"$mod, SPACE, exec, rofi -show drun"
# Restore lock - these are `bindl` in your original, but `exec` should be fine here.
# However, `bindl` is typically for a *release* event. If `caelestia shell -d` is a daemon,
# and `caelestia:lock` is a quickshell internal, you might need to reconsider.
# For direct translation, they go into `bindl` list.
# Media - handled by bindl below
# Apps
"$mod, Return, exec, app2unit -- kitty"
"$mod, W, exec, app2unit -- firefox"
"$mod, E, exec, app2unit -- thunar"
"$mod, Q, killactive"
"$mod ALT, E, exec, app2unit -- nemo"
"Control+Alt, Escape, exec, app2unit -- qps"
"Control+Alt, V, exec, app2unit -- pavucontrol"
# Utilities
"$mod SHIFT, S, global, caelestia:screenshotFreeze"
"$mod SHIFT ALT, S, global, caelestia:screenshot"
"$mod ALT, R, exec, caelestia record -s"
"Control+Alt, R, exec, caelestia record"
"$mod SHIFT ALT, R, exec, caelestia record -r"
"$mod SHIFT, C, exec, hyprpicker -a" # Colour picker
# Sleep
"$mod SHIFT, PRINT, exec, systemctl suspend-then-hibernate"
# Clipboard and emoji picker
"$mod, V, exec, pkill fuzzel || caelestia clipboard"
"$mod ALT, V, exec, pkill fuzzel || caelestia clipboard -d"
"$mod, Period, exec, pkill fuzzel || caelestia emoji -p"
# Testing
# This is a `bindl` (key release), so move it to `bindl` list below.
# Window actions
"$mod, H, movefocus, l"
"$mod, L, movefocus, r"
"$mod, K, movefocus, u"
"$mod, J, movefocus, d"
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, L, movewindow, r"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, J, movewindow, d"
"$mod CTRL, Backslash, centerwindow, 1"
"$mod CTRL ALT, Backslash, resizeactive, exact 55% 70%"
"$mod CTRL ALT, Backslash, centerwindow, 1"
"$mod ALT, Backslash, exec, caelestia pip"
"$mod, P, pin"
"$mod, F, fullscreen, 0"
"$mod ALT, F, fullscreen, 1"
# Special workspace toggles
"Control+Shift, Escape, exec, caelestia toggle sysmon"
"$mod, Escape, exec, caelestia toggle sysmon"
"$mod, M, exec, caelestia toggle music"
"$mod, D, exec, caelestia toggle communication"
"$mod, R, exec, caelestia toggle todo"
"$mod, G, togglespecialworkspace, gaming"
"$mod SHIFT, G, movetoworkspace, special:gaming"
"$mod, T, exec, caelestia toggle steam"
# "$mod, T, togglespecialworkspace, special:steam"
# "$mod SHIFT, T, movetoworkspace, special:steam"
# Toggle special workspace
"$mod, S, exec, caelestia toggle specialws"
# Window groups
"$mod, Comma, togglegroup"
"$mod SHIFT, Comma, lockactivegroup, toggle"
# Go to workspace -1/+1 (mouse binds are `bind` for mouse-wheel)
"$mod, mouse_down, workspace, -1"
"$mod, mouse_up, workspace, +1"
# Move window to workspace -1/+1
"$mod ALT, mouse_down, movetoworkspace, -1"
"$mod ALT, mouse_up, movetoworkspace, +1"
# Move window to/from special workspace
"$mod CTRL SHIFT, up, movetoworkspace, special:special"
"$mod CTRL SHIFT, down, movetoworkspace, e+0"
"$mod ALT, S, movetoworkspace, special:special"
]
++ (
# Go to workspace #
let
wsaction = "~/.config/hypr/scripts/wsaction.fish";
in
builtins.concatLists (builtins.genList (
i: let
ws = i + 1;
in [
"$mod, ${toString ws}, exec, ${wsaction} workspace ${toString ws}"
]
)
9) # For workspaces 1-9
)
++ [
# "$mod, 0, exec, ${config.wayland.windowManager.hyprland.settings.workspaceRule."0".exec} workspace 10" # Workaround for workspace 0
# Re-adding `wsaction` since it's used here.
"$mod, 0, exec, ~/.config/hypr/scripts/wsaction.fish workspace 10"
]
++ (
# Go to workspace group #
let
wsaction = "~/.config/hypr/scripts/wsaction.fish";
in
builtins.concatLists (builtins.genList (
i: let
ws = i + 1;
in [
"Control+$mod, ${toString ws}, exec, ${wsaction} -g workspace ${toString ws}"
]
)
9)
)
++ [
"Control+$mod, 0, exec, ~/.config/hypr/scripts/wsaction.fish -g workspace 10"
]
++ (
# Move window to workspace #
let
wsaction = "~/.config/hypr/scripts/wsaction.fish";
in
builtins.concatLists (builtins.genList (
i: let
ws = i + 1;
in [
"$mod SHIFT, ${toString ws}, exec, ${wsaction} movetoworkspace ${toString ws}"
]
)
9)
)
++ [
"$mod SHIFT, 0, exec, ~/.config/hypr/scripts/wsaction.fish movetoworkspace 10"
]
++ (
# Move window to workspace group #
let
wsaction = "~/.config/hypr/scripts/wsaction.fish";
in
builtins.concatLists (builtins.genList (
i: let
ws = i + 1;
in [
"Control+$mod ALT, ${toString ws}, exec, ${wsaction} -g movetoworkspace ${toString ws}"
]
)
9)
)
++ [
"Control+$mod ALT, 0, exec, ~/.config/hypr/scripts/wsaction.fish -g movetoworkspace 10"
];
binde = [
"$mod, Minus, splitratio, -0.1"
"$mod, Equal, splitratio, 0.1"
"Control+$mod, left, workspace, -1"
"$mod, Page_Up, workspace, -1"
"Control+$mod, right, workspace, +1"
"$mod, Page_Down, workspace, +1"
"$mod ALT, Page_Up, movetoworkspace, -1"
"$mod ALT, Page_Down, movetoworkspace, +1"
"Control+$mod SHIFT, right, movetoworkspace, +1"
"Control+$mod SHIFT, left, movetoworkspace, -1"
"Alt, Tab, cyclenext, activewindow" # `binde` for cycle next
"Control+Alt, Tab, changegroupactive, f" # `binde` for change group active
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, Z, movewindow"
"$mod, mouse:273, resizewindow"
"$mod, X, resizewindow"
];
bindl = [
# Restore lock
"$mod ALT, L, exec, caelestia shell -d"
"$mod ALT, L, global, caelestia:lock" # This is a Hyprland `global` command, not an `exec`
# Brightness
", XF86MonBrightnessUp, global, caelestia:brightnessUp"
", XF86MonBrightnessDown, global, caelestia:brightnessDown"
# Media
"Control+$mod, Space, global, caelestia:mediaToggle"
", XF86AudioPlay, global, caelestia:mediaToggle"
", XF86AudioPause, global, caelestia:mediaToggle"
"Control+$mod, Equal, global, caelestia:mediaNext"
", XF86AudioNext, global, caelestia:mediaNext"
"Control+$mod, Minus, global, caelestia:mediaPrev"
", XF86AudioPrev, global, caelestia:mediaPrev"
", XF86AudioStop, global, caelestia:mediaStop"
# Utilities (screenshot is `bindl` in your original)
", Print, exec, caelestia screenshot" # Full screen capture > clipboard
# Volume
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
"$mod SHIFT, M, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
# Clipboard and emoji picker (alternate paste is `bindl`)
"Control+Shift+Alt, V, exec, sleep 0.5s && ydotool type -d 1 \"$(cliphist list | head -1 | cliphist decode)\""
# Testing
"$mod ALT, f12, exec, notify-send -u low -i dialog-information-symbolic 'Test notification' \"Here's a really long message to test truncation and wrapping\\nYou can middle click or flick this notification to dismiss it!\" -a 'Shell' -A \"Test1=I got it!\" -A \"Test2=Another action\""
];
bindel = [
# Volume
", XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 10%+"
", XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 10%-"
];
bindr = [
# Kill/restart
"Control+$mod SHIFT, R, exec, qs -c caelestia kill"
"Control+$mod ALT, R, exec, qs -c caelestia kill; caelestia shell -d"
];
};
}