nicks-nix-config/modules/hyprland/keybinds.nix

86 lines
2.6 KiB
Nix
Raw Normal View History

2023-10-30 18:12:43 -07:00
{lib, pkgs, ...}:
2023-10-24 18:31:26 -07:00
let
workspaces =
(map toString (lib.range 0 9)) ++
(map (n: "F${toString n}") (lib.range 1 12));
# Map keys to hyprland directions
directions = rec {
left = "l"; right = "r"; up = "u"; down = "d";
h = left; l = right; k = up; j = down;
};
in
{
wayland.windowManager.hyprland.settings = {
bindm = [
# mouse movements
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];
2023-10-30 18:12:43 -07:00
# binde, will repeat when held
#https://wiki.hyprland.org/Configuring/Binds/#bind-flags
binde = [
2023-11-16 16:24:23 -08:00
",XF86AudioRaiseVolume, exec, pw-volume change +1%; ${pkgs.eww}/bin/eww update volume=$(pw-volume status | jaq '.percentage // 10')"
",XF86AudioLowerVolume, exec, pw-volume change -1%; ${pkgs.eww}/bin/eww update volume=$(pw-volume status | jaq '.percentage // 10')"
2023-10-30 18:12:43 -07:00
];
2023-10-30 21:17:26 -07:00
# listen even when locked
bindl = [
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioNext, exec, playerctl next"
",XF86AudioNext, exec, playerctl previous"
];
2023-10-24 18:31:26 -07:00
bind = [
2023-10-30 18:12:43 -07:00
",XF86AudioMute, exec, pw-volume mute toggle"
2023-10-24 18:31:26 -07:00
"$mod, RETURN, exec, kitty"
"$mod, r, exec, rofi -show run window"
"$mod, q, killactive"
"$mod_SHIFT, p, exit"
"$mod, SPACE, togglefloating"
"$mod, ;, fullscreen"
# scroll through existing workspaces
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
2024-08-22 20:09:35 -07:00
"CTRL_SHIFT, h, exec, ewwtilities prev-next-workspace 0"
"CTRL_SHIFT, l, exec, ewwtilities prev-next-workspace 1"
2023-10-24 18:31:26 -07:00
] ++
# Change workspace
(map (n:
2024-11-22 20:00:49 -08:00
"$mod,${n}, exec, ewwtilities workspace ${n} --switch-workspace"
2023-10-24 18:31:26 -07:00
) workspaces) ++
# Move window to workspace
(map (n:
2024-11-22 20:00:49 -08:00
"$modSHIFT,${n}, exec, ewwtilities workspace ${n} --move-window"
2023-10-24 18:31:26 -07:00
) workspaces) ++
# Move focus
(lib.mapAttrsToList (key: direction:
"$mod,${key},movefocus,${direction}"
) directions) ++
# Swap windows
(lib.mapAttrsToList (key: direction:
"$modSHIFT,${key},swapwindow,${direction}"
) directions) ++
# Move windows
(lib.mapAttrsToList (key: direction:
"$modCONTROL,${key},movewindoworgroup,${direction}"
) directions) ++
# Move monitor focus
(lib.mapAttrsToList (key: direction:
"$modALT,${key},focusmonitor,${direction}"
) directions) ++
# Move workspace to other monitor
(lib.mapAttrsToList (key: direction:
"$modALTSHIFT,${key},movecurrentworkspacetomonitor,${direction}"
) directions);
};
}