diff --git a/ruysch-graphical.nix b/ruysch-graphical.nix index 03c5177..a66404d 100644 --- a/ruysch-graphical.nix +++ b/ruysch-graphical.nix @@ -33,14 +33,34 @@ ]; }; - etc = { + etc = let + bluetoothctl = "${pkgs.bluez}/bin/bluetoothctl"; + brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; + busctl = "${pkgs.systemd}/bin/busctl"; + emote = "${pkgs.emote}/bin/emote"; + firefox = "${pkgs.firefox}/bin/firefox"; + gnome-terminal = "${pkgs.gnome-terminal}/bin/gnome-terminal"; + hyprlock = "${pkgs.hyprlock}/bin/hyprlock"; + ironbar = "${pkgs.ironbar}/bin/ironbar"; + loginctl = "${pkgs.systemd}/bin/loginctl"; + nautilus = "${pkgs.nautilus}/bin/nautilus"; + nmcli = "${pkgs.networkmanager}/bin/nmcli"; + nwg-bar = "${pkgs.nwg-bar}/bin/nwg-bar"; + pactl = "${pkgs.pulseaudio}/bin/pactl"; + playerctl = "${pkgs.playerctl}/bin/playerctl"; + rofi = "${pkgs.rofi}/bin/rofi"; + swaybg = "${pkgs.swaybg}/bin/swaybg"; + swayidle = "${pkgs.swayidle}/bin/swayidle"; + systemctl = "${pkgs.systemd}/bin/systemctl"; + wl-gammarelay-rs = "${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs"; + wlr-randr = "${pkgs.wlr-randr}/bin/wlr-randr"; + in { "niri/config.kdl".text = '' - spawn-at-startup "${pkgs.swaybg}/bin/swaybg" "--image" \ + spawn-at-startup "${swaybg}" "--image" \ "/home/rei/projects/infrastructure/nixos/assets/wallpaper-macos-swirlies" - spawn-at-startup "${pkgs.ironbar}/bin/ironbar" - spawn-at-startup "${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs" - spawn-at-startup "${pkgs.swayidle}/bin/swayidle" "timeout" "600" \ - "${pkgs.hyprlock}/bin/hyprlock" + spawn-at-startup "${ironbar}" + spawn-at-startup "${wl-gammarelay-rs}" + spawn-at-startup "${swayidle}" "timeout" "600" "${hyprlock}" @@ -97,71 +117,67 @@ binds { Super+Q { close-window; } - Super+W { spawn "${pkgs.rofi}/bin/rofi" "-show" "drun"; } - Super+E { spawn "${pkgs.gnome-terminal}/bin/gnome-terminal"; } - Super+R { spawn "${pkgs.nautilus}/bin/nautilus"; } + Super+W { spawn "${rofi}" "-show" "drun"; } + Super+E { spawn "${gnome-terminal}"; } + Super+R { spawn "${nautilus}"; } - Super+T { spawn "${pkgs.firefox}/bin/firefox"; } - Super+Shift+T { spawn "${pkgs.firefox}/bin/firefox" "--private-window"; } + Super+T { spawn "${firefox}"; } + Super+Shift+T { spawn "${firefox}" "--private-window"; } Super+A { center-column; } Super+S { switch-preset-column-width; } Super+D { toggle-window-floating; } Super+U allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "-2%" + spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "-2%" } Super+I allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "+2%" + spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "+2%" } Super+Shift+I allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "100%" + spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "100%" } Super+O allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle" + spawn "${pactl}" "set-sink-mute" "@DEFAULT_SINK@" "toggle" } - Super+P allow-when-locked=true { - spawn "${pkgs.wlr-randr}/bin/wlr-randr" "--output" "eDP-1" "--toggle" - } + Super+P allow-when-locked=true { spawn "${wlr-randr}" "--output" "eDP-1" "--toggle"; } // TODO: Replace with toggle script. - Super+H { spawn "${pkgs.networkmanager}/bin/nmcli" "connection" "up" "airvpn-serbia"; } - Super+Shift+H { - spawn "${pkgs.networkmanager}/bin/nmcli" "connection" "down" "airvpn-serbia" - } + Super+H { spawn "${nmcli}" "connection" "up" "airvpn-serbia"; } + Super+Shift+H { spawn "${nmcli}" "connection" "down" "airvpn-serbia"; } - Super+J { spawn "${pkgs.emote}/bin/emote"; } + Super+J { spawn "${emote}"; } // TODO: Put this in linux-utils as Nix package. // Super+K allow-when-locked=true { spawn "wl-gammarelay-toggle-temperature"; } Super+K allow-when-locked=true { - spawn "${pkgs.systemd}/bin/busctl" "--user" "set-property" "rs.wl-gammarelay" "/" \ - "rs.wl.gammarelay" "Temperature" "q" "4500" + spawn "${busctl}" "--user" "set-property" "rs.wl-gammarelay" "/" "rs.wl.gammarelay" \ + "Temperature" "q" "4500" } Super+Shift+K allow-when-locked=true { - spawn "${pkgs.systemd}/bin/busctl" "--user" "set-property" "rs.wl-gammarelay" "/" \ - "rs.wl.gammarelay" "Temperature" "q" "6500" + spawn "${busctl}" "--user" "set-property" "rs.wl-gammarelay" "/" "rs.wl.gammarelay" \ + "Temperature" "q" "6500" } // TODO: Set up session-based locking like on Arch. - // Super+L { spawn "${pkgs.systemd}/bin/loginctl" "lock-session"; } - Super+L { spawn "${pkgs.hyprlock}/bin/hyprlock"; } + // Super+L { spawn "${loginctl}" "lock-session"; } + Super+L { spawn "${hyprlock}"; } // I.e. the Non-Screeching Earwarmers. - Super+B { spawn "${pkgs.bluez}/bin/bluetoothctl" "connect" "58:18:62:1F:E3:33"; } - Super+Shift+B { spawn "${pkgs.bluez}/bin/bluetoothctl" "disconnect" "58:18:62:1F:E3:33"; } + Super+B { spawn "${bluetoothctl}" "connect" "58:18:62:1F:E3:33"; } + Super+Shift+B { spawn "${bluetoothctl}" "disconnect" "58:18:62:1F:E3:33"; } - Super+M { spawn "${pkgs.playerctl}/bin/playerctl" "play-pause"; } - Super+Comma { spawn "${pkgs.playerctl}/bin/playerctl" "previous"; } - Super+Period { spawn "${pkgs.playerctl}/bin/playerctl" "next"; } + Super+M { spawn "${playerctl}" "play-pause"; } + Super+Comma { spawn "${playerctl}" "previous"; } + Super+Period { spawn "${playerctl}" "next"; } - // TODO: Turn in to Nix package. + // TODO: Turn into Nix package. // Super+BracketLeft allow-when-locked=true { spawn "ddc-brightness" "down"; } // Super+BracketRight allow-when-locked=true { spawn "ddc-brightness" "up"; } // Super+Shift+BracketRight allow-when-locked=true { spawn "ddc-brightness" "max"; } Super+Tab { toggle-overview; } Super+Space { switch-layout "next"; } - Super+Escape { spawn "${pkgs.nwg-bar}/bin/nwg-bar"; } + Super+Escape { spawn "${nwg-bar}"; } Super+F11 { fullscreen-window; } Super+Left { focus-column-left; } @@ -192,30 +208,24 @@ // TODO: Add back rectangle screenshot selection. Print { screenshot; } Super+Print { screenshot-window; } + + // Special function keys. - XF86MonBrightnessDown allow-when-locked=true { - spawn "${pkgs.brightnessctl}/bin/brightnessctl" "set" "10%-" - } - XF86MonBrightnessUp allow-when-locked=true { - spawn "${pkgs.brightnessctl}/bin/brightnessctl" "set" "+10%" - } + XF86MonBrightnessDown allow-when-locked=true { spawn "${brightnessctl}" "set" "10%-"; } + XF86MonBrightnessUp allow-when-locked=true { spawn "${brightnessctl}" "set" "+10%"; } XF86AudioLowerVolume allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "-2%" + spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "-2%" } XF86AudioRaiseVolume allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "+2%" + spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "+2%" } XF86AudioMute allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle" + spawn "${pactl}" "set-sink-mute" "@DEFAULT_SINK@" "toggle" } - XF86AudioPlay allow-when-locked=true { - spawn "${pkgs.playerctl}/bin/playerctl" "play-pause" - } - XF86AudioPause allow-when-locked=true { - spawn "${pkgs.playerctl}/bin/playerctl" "play-pause" - } + XF86AudioPlay allow-when-locked=true { spawn "${playerctl}" "play-pause"; } + XF86AudioPause allow-when-locked=true { spawn "${playerctl}" "play-pause"; } } @@ -240,7 +250,7 @@ "nwg-bar/bar.json".text = '' [ { "label": "_Lock", - "exec": "${pkgs.systemd}/bin/loginctl lock-session", + "exec": "${loginctl} lock-session", "icon": "/usr/local/share/icons/kernelmaft/scalable/system-lock-screen-symbolic.svg" }, { "label": "Log out", @@ -248,19 +258,19 @@ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-log-out-symbolic.svg" }, { "label": "_Suspend", - "exec": "${pkgs.systemd}/bin/systemctl suspend", + "exec": "${systemctl} suspend", "icon": "/usr/local/share/icons/kernelmaft/scalable/system-suspend-symbolic.svg" }, { "label": "_Hibernate", - "exec": "${pkgs.systemd}/bin/systemctl hibernate", + "exec": "${systemctl} hibernate", "icon": "/usr/local/share/icons/kernelmaft/scalable/system-suspend-symbolic.svg" }, { "label": "Shut down", - "exec": "${pkgs.systemd}/bin/systemctl poweroff", + "exec": "${systemctl} poweroff", "icon": "/usr/local/share/icons/kernelmaft/scalable/system-shutdown-symbolic.svg" }, { "label": "Reboot", - "exec": "${pkgs.systemd}/bin/systemctl reboot", + "exec": "${systemctl} reboot", "icon": "/usr/local/share/icons/kernelmaft/scalable/system-restart-symbolic.svg" } ] '';