Files
nixy/home/system/hyprland/bindings.nix
T
kptltd00m fe508d9cd8 Migrate Hyprland to Lua config, drop dead flake inputs, general cleanup
Hyprland
- Switch wayland.windowManager.hyprland to configType = "lua" (Hyprland 0.56)
- Convert settings, env, monitors, window rules, gesture, animations
  (hl.curve/hl.animation) and all keybinds to hl.* calls
- Add home/system/hyprland/lib.nix with exec/bind/execOnce helpers;
  every exec-once now runs from a hyprland.start hook
- Drop hard-coded default_monitor = "eDP-2"

Flake
- Remove blog, awesome-wallpapers and default-creds inputs (their repos
  no longer ship a flake.nix and broke `nix flake update`), along with
  the server modules and Glance links that used them
- Update flake.lock
- Replace removed `gcr` with `gcr_4`

Fixes
- Point configDirectory at /etc/nixos/nixy on home-pc and thinkpad
- Fix home-pc git email typo
- Remove conflicting openpgp signing format, make pull.rebase a boolean,
  replace hx/peco in git aliases with nvim/sk
- Fix zsh NUL alias (2>&1) and stop forcing bat colors in the cat alias
- Require a password for sudo again (nixos-rebuild stays NOPASSWD)
- Remove duplicate hardware.graphics block from home-pc flake
- Delete unused zen .old files, run alejandra on host files
2026-09-28 18:15:30 +02:00

387 lines
10 KiB
Nix

{
pkgs,
lib,
config,
pkgs-nur-hadi,
...
}: let
hl = import ./lib.nix {inherit lib;};
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 = {
bind =
[
# Applications
(hl.bind "SUPER + SHIFT + A" (hl.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;
}
])))
null)
(hl.bind "SUPER + B" (hl.exec "uwsm app -- ${config.programs.librewolf.package}/bin/helium") null) # Browser
# Power
(hl.bind "SUPER + X" (hl.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";
}
])))
null)
# Quick launch
(hl.bind "SUPER + RETURN" (hl.exec "uwsm app -- ${pkgs.ghostty}/bin/ghostty") null) # Ghostty (terminal)
(hl.bind "SUPER + E" (hl.exec "uwsm app -- ${pkgs.thunar}/bin/thunar") null) # Thunar
(hl.bind "SUPER + SPACE" (hl.exec "walker") null) # Launcher
(hl.bind "SUPER + N" (hl.exec "${lib.getExe pkgs.grimblast} save area") null) # Save screenshot
(hl.bind "SUPER + D" (hl.exec "${lib.getExe pkgs.grimblast} copy area") null) # Copy screenshot
# Windows
(hl.bind "SUPER + Q" (hl.mkLuaInline "hl.dsp.window.close()") null) # Close window
(hl.bind "SUPER + F" (hl.mkLuaInline ''hl.dsp.window.fullscreen({ mode = "fullscreen" })'') null) # Toggle Fullscreen
(hl.bind "SUPER + SHIFT + F" (hl.mkLuaInline ''hl.dsp.window.float({ action = "toggle" })'') null) # Toggle Floating
# Focus Windows
(hl.bind "SUPER + H" (hl.mkLuaInline ''hl.dsp.focus({ direction = "left" })'') null) # Move focus left
(hl.bind "SUPER + J" (hl.mkLuaInline ''hl.dsp.focus({ direction = "down" })'') null) # Move focus Down
(hl.bind "SUPER + K" (hl.mkLuaInline ''hl.dsp.focus({ direction = "up" })'') null) # Move focus Up
(hl.bind "SUPER + L" (hl.mkLuaInline ''hl.dsp.focus({ direction = "right" })'') null) # Move focus Right
(hl.bind "SUPER + SHIFT + H" (hl.mkLuaInline ''hl.dsp.focus({ monitor = "-1" })'') null) # Focus previous monitor
(hl.bind "SUPER + SHIFT + J" (hl.mkLuaInline ''hl.dsp.layout("removemaster")'') null) # Remove from master
(hl.bind "SUPER + SHIFT + K" (hl.mkLuaInline ''hl.dsp.layout("addmaster")'') null) # Add to master
(hl.bind "SUPER + SHIFT + L" (hl.mkLuaInline ''hl.dsp.focus({ monitor = "+1" })'') null) # Focus next monitor
# Utilities
(hl.bind "SUPER + SHIFT + S" (hl.exec "${lib.getExe pkgs.grimblast} copy area") null) # Capture region
(hl.bind "Print" (hl.exec "${lib.getExe pkgs.grimblast} copy area") null) # Capture region
(hl.bind "SUPER + SHIFT + ALT + S" (hl.exec "${lib.getExe pkgs.grimblast} save area") null) # Capture region
]
# Workspaces: keycodes 10-18 are the number row keys 1-9
++ (builtins.concatLists (
builtins.genList (
i: let
ws = toString (i + 1);
in [
(hl.bind "SUPER + code:1${toString i}" (hl.mkLuaInline "hl.dsp.focus({ workspace = ${ws} })") null)
(hl.bind "SUPER + SHIFT + code:1${toString i}" (hl.mkLuaInline "hl.dsp.window.move({ workspace = ${ws} })") null)
]
)
9
))
# Mouse
++ [
(hl.bind "SUPER + mouse:272" (hl.mkLuaInline "hl.dsp.window.drag()") {mouse = true;}) # Move Window (mouse)
(hl.bind "SUPER + R" (hl.mkLuaInline "hl.dsp.window.resize()") {mouse = true;}) # Resize Window (mouse)
]
# Locked (also work on the lockscreen)
++ (map (b: hl.bind b.key (hl.exec b.cmd) {locked = true;}) [
# Brightness
{
key = "XF86MonBrightnessUp";
cmd = "${lib.getExe pkgs.brightnessctl} set 5%+";
}
{
key = "XF86MonBrightnessDown";
cmd = "${lib.getExe pkgs.brightnessctl} set 5%-";
}
# Media
{
key = "XF86AudioPlay";
cmd = "${lib.getExe pkgs.playerctl} play-pause";
}
{
key = "XF86AudioPause";
cmd = "${lib.getExe pkgs.playerctl} play-pause";
}
{
key = "XF86AudioNext";
cmd = "${lib.getExe pkgs.playerctl} next";
}
{
key = "XF86AudioPrev";
cmd = "${lib.getExe pkgs.playerctl} previous";
}
{
key = "XF86AudioStop";
cmd = "${lib.getExe pkgs.playerctl} stop";
}
# Sound
{
key = "XF86AudioMute";
cmd = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
}
{
key = "XF86AudioRaiseVolume";
cmd = "wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+";
}
{
key = "XF86AudioLowerVolume";
cmd = "wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
}
]);
};
}