Files
nixy/home/system/hyprland/bindings.nix
T
kptltd00m bcfe305813 Add Hyprlock and refactor Hyprland bindings
- Add hyprlock module and package plus hyprlock.conf XDG config
- Rework bindings: introduce mkMenu, gui/term helpers and grouped
  menus (apps, dev, gaming, utility, system) and wire them into the
  main popup; change session lock to hyprlock
- Simplify gaming-apps.nix: use pkgs, reorder packages and add
  wineWow64Packages.staging, steam-run and appimage-run
2026-06-28 15:36:40 +02:00

365 lines
8.7 KiB
Nix

{
pkgs,
lib,
config,
pkgs-nur-hadi,
...
}:
let
colors = config.lib.stylix.colors;
mkMenu = menu:
let
configFile = pkgs.writeText "config.yaml" (
lib.generators.toYAML { } {
anchor = "bottom-right";
border = "#${colors.base0D}80";
background = "#${colors.base01}EE";
color = "#${colors.base05}";
margin_right = 15;
margin_bottom = 15;
rows_per_column = 5;
inherit menu;
}
);
in
pkgs.writeShellScriptBin "menu" ''
exec ${lib.getExe pkgs.wlr-which-key} ${configFile}
'';
gui = exe: "uwsm app -- ${exe}";
term = exe: "uwsm app -- ${pkgs.ghostty}/bin/ghostty -e ${exe}";
appsMenu = mkMenu [
{
key = "f";
desc = "Firefox";
cmd = gui "${pkgs.firefox}/bin/firefox";
}
{
key = "o";
desc = "Obsidian";
cmd = gui "${pkgs.obsidian}/bin/obsidian";
}
{
key = "t";
desc = "TickTick";
cmd = gui "${pkgs.ticktick}/bin/ticktick";
}
{
key = "n";
desc = "OnlyOffice";
cmd = gui "${pkgs.onlyoffice-desktopeditors}/bin/onlyoffice-desktopeditors";
}
{
key = "v";
desc = "Vesktop";
cmd = gui "${pkgs.vesktop}/bin/vesktop";
}
{
key = "l";
desc = "VLC";
cmd = gui "${pkgs.vlc}/bin/vlc";
}
];
devMenu = mkMenu [
{
key = "z";
desc = "Zed";
cmd = gui "${pkgs.zed-editor}/bin/zed";
}
{
key = "c";
desc = "VSCodium";
cmd = gui "${pkgs.vscodium}/bin/codium";
}
{
key = "g";
desc = "Ghostty";
cmd = gui "${pkgs.ghostty}/bin/ghostty";
}
{
key = "f";
desc = "Fastfetch";
cmd = term "${pkgs.fastfetch}/bin/fastfetch";
}
{
key = "d";
desc = "Dysk";
cmd = term "${pkgs.dysk}/bin/dysk";
}
{
key = "w";
desc = "Wikiman";
cmd = term "${pkgs.wikiman}/bin/wikiman";
}
{
key = "s";
desc = "STTR";
cmd = term "${pkgs.sttr}/bin/sttr";
}
];
gamingMenu = mkMenu [
{
key = "l";
desc = "Lutris";
cmd = gui "${pkgs.lutris}/bin/lutris";
}
{
key = "p";
desc = "ProtonUp-Qt";
cmd = gui "${pkgs.protonup-qt}/bin/protonup-qt";
}
{
key = "g";
desc = "GOverlay";
cmd = gui "${pkgs.goverlay}/bin/goverlay";
}
];
utilityMenu = mkMenu [
{
key = "B";
desc = "Blueman";
cmd = gui "${pkgs.blueman}/bin/blueman-manager";
}
{
key = "x";
desc = "Bluetoothctl";
cmd = term "${pkgs.bluez}/bin/bluetoothctl";
}
{
key = "w";
desc = "WiFi TUI";
cmd = term "${pkgs.wifitui}/bin/wifitui";
}
{
key = "m";
desc = "Wiremix";
cmd = term "${pkgs.wiremix}/bin/wiremix";
}
{
key = "u";
desc = "USBGuard TUI";
cmd = term "${pkgs-nur-hadi.usbguard-tui}/bin/usbguard-tui";
}
{
key = "c";
desc = "Caligula";
cmd = term "${pkgs.caligula}/bin/caligula";
}
{
key = "h";
desc = "Browsh";
cmd = term "${pkgs.browsh}/bin/browsh";
}
{
key = "p";
desc = "Peaclock";
cmd = term "${pkgs.peaclock}/bin/peaclock";
}
{
key = "o";
desc = "Cbonsai";
cmd = term "${pkgs.cbonsai}/bin/cbonsai";
}
{
key = "i";
desc = "Pipes";
cmd = term "${pkgs.pipes}/bin/pipes";
}
{
key = "t";
desc = "Tealdeer";
cmd = term "${pkgs.tealdeer}/bin/tldr";
}
{
key = "s";
desc = "Hyprlock";
cmd = gui "${pkgs.hyprlock}/bin/hyprlock";
}
];
systemMenu = mkMenu [
{
key = "l";
desc = "Lock";
cmd = "hyprlock";
}
{
key = "w";
desc = "Restart Waybar";
cmd = "pkill -x waybar; waybar";
}
{
key = "r";
desc = "Restart Walker";
cmd = "systemctl --user restart walker.service";
}
{
key = "e";
desc = "Restart Elephant";
cmd = "systemctl --user restart elephant.service";
}
{
key = "s";
desc = "Suspend";
cmd = "systemctl suspend";
}
{
key = "p";
desc = "Power Off";
cmd = "systemctl poweroff";
}
{
key = "b";
desc = "Reboot";
cmd = "systemctl reboot";
}
];
in
{
wayland.windowManager.hyprland.settings = {
"$mod" = "SUPER";
"$shiftMod" = "SUPER_SHIFT";
bind =
[
# Applications
(
"$shiftMod, A, exec, "
+ lib.getExe (mkMenu [
{
key = "a";
desc = "Apps";
cmd = lib.getExe appsMenu;
}
{
key = "d";
desc = "Dev";
cmd = lib.getExe devMenu;
}
{
key = "g";
desc = "Gaming";
cmd = lib.getExe gamingMenu;
}
{
key = "u";
desc = "Utilities";
cmd = lib.getExe utilityMenu;
}
{
key = "s";
desc = "System";
cmd = lib.getExe systemMenu;
}
])
)
"$mod,B, exec, uwsm app -- ${config.programs.librewolf.package}/bin/helium" # Browser
# Power
(
"$mod, X, exec, "
+ lib.getExe (mkMenu [
{
key = "l";
desc = "Lock";
cmd = "hyprlock";
}
{
key = "s";
desc = "Suspend";
cmd = "systemctl suspend";
}
{
key = "r";
desc = "Reboot";
cmd = "systemctl reboot";
}
{
key = "p";
desc = "Power Off";
cmd = "systemctl poweroff";
}
{
key = "n";
desc = "Nightshift";
cmd = "nightshift-toggle";
}
{
key = "c";
desc = "Restart Waybar";
cmd = "pkill -x waybar; waybar";
}
])
)
# Quick launch
"$mod,RETURN, exec, uwsm app -- ${pkgs.ghostty}/bin/ghostty" # Ghostty (terminal)
"$mod,E, exec, uwsm app -- ${pkgs.thunar}/bin/thunar" # Thunar
"$mod, SPACE, exec, walker" # Launcher
"$mod, N, exec, ${lib.getExe pkgs.grimblast} save area" # Save screenshot
"$mod, D, exec, ${lib.getExe pkgs.grimblast} copy area" # Copy screenshot
# Windows
"$mod,Q, killactive," # Close window
"$mod,F, fullscreen" # Toggle Fullscreen
"$shiftMod,F, togglefloating," # Toggle Floating
# Focus Windows
"$mod,H, movefocus, l" # Move focus left
"$mod,J, movefocus, d" # Move focus Down
"$mod,K, movefocus, u" # Move focus Up
"$mod,L, movefocus, r" # Move focus Right
"$shiftMod,H, focusmonitor, -1" # Focus previous monitor
"$shiftMod,J, layoutmsg, removemaster" # Remove from master
"$shiftMod,K, layoutmsg, addmaster" # Add to master
"$shiftMod,L, focusmonitor, 1" # Focus next monitor
# Utilities
"$shiftMod, S, exec, ${lib.getExe pkgs.grimblast} copy area" # Capture region
", Print, exec, ${lib.getExe pkgs.grimblast} copy area" # Capture region
"$shiftMod+Alt, S, exec, ${lib.getExe pkgs.grimblast} save area" # Capture region
]
++ (builtins.concatLists (
builtins.genList (
i: let
ws = i + 1;
in [
"$mod,code:1${toString i}, workspace, ${toString ws}"
"$mod SHIFT,code:1${toString i}, movetoworkspace, ${toString ws}"
]
)
9
));
bindm = [
"$mod,mouse:272, movewindow" # Move Window (mouse)
"$mod,R, resizewindow" # Resize Window (mouse)
];
bindl = [
# Brightness
", XF86MonBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} set 5%+"
", XF86MonBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} set 5%-"
# Media
", XF86AudioPlay, exec, ${lib.getExe pkgs.playerctl} play-pause"
", XF86AudioPause, exec, ${lib.getExe pkgs.playerctl} play-pause"
", XF86AudioNext, exec, ${lib.getExe pkgs.playerctl} next"
", XF86AudioPrev, exec, ${lib.getExe pkgs.playerctl} previous"
", XF86AudioStop, exec, ${lib.getExe pkgs.playerctl} stop"
# Sound
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
];
};
}