My Nix Configuration
1{ config, lib, ... }: 2let 3 inherit (config.wayland.windowManager.sway.config) menu; 4 mod = config.wayland.windowManager.sway.config.modifier; 5 term = config.wayland.windowManager.sway.config.terminal; 6 grim = "grim -g"; 7 slurp-screen = "\"$(slurp -c -b '#1e1e2e80' -o -r)\" -"; 8 slurp-box = "\"$(slurp -c '#f38ba8ff' -b '#1e1e2e80' -w 1 -d -F 'IBM Plex Mono')\" -"; 9 satty = "satty -f -"; 10 cfg = config.py.gui; 11in 12{ 13 config.wayland.windowManager.sway.config.keybindings = lib.mkIf cfg.enable ( 14 lib.mkOptionDefault { 15 "${mod}+d" = "${menu}"; 16 "${mod}+Shift+F" = "exec MOZ_DISABLE_RDD_SANDBOX=1 firefox"; 17 "${mod}+Return" = "exec ${term}"; 18 "${mod}+x" = "exec wlogout"; 19 "${mod}+s" = null; 20 "${mod}+w" = null; 21 "XF86MonBrightnessDown" = "exec brightnessctl set 5%-"; 22 "XF86MonBrightnessUp" = "exec brightnessctl set +5%"; 23 "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; 24 "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; 25 "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; 26 "XF86AudioMicMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; 27 "XF86AudioPlay" = "exec playerctl play-pause"; 28 "XF86AudioNext" = "exec playerctl next"; 29 "XF86AudioPrev" = "exec playerctl previous"; 30 "Shift+F3" = "exec ${grim} ${slurp-screen} | ${satty}"; 31 "Shift+F4" = "exec ${grim} ${slurp-box} | ${satty}"; 32 "${mod}+Shift+1" = "move container to workspace number 1"; 33 "${mod}+Shift+2" = "move container to workspace number 2"; 34 "${mod}+Shift+3" = "move container to workspace number 3"; 35 "${mod}+Shift+4" = "move container to workspace number 4"; 36 "${mod}+Shift+5" = "move container to workspace number 5"; 37 "${mod}+Shift+6" = "move container to workspace number 6"; 38 "${mod}+Shift+7" = "move container to workspace number 7"; 39 "${mod}+Shift+8" = "move container to workspace number 8"; 40 "${mod}+Shift+9" = "move container to workspace number 9"; 41 "${mod}+Shift+0" = "move container to workspace number 10"; 42 "${mod}+0" = "workspace number 10"; 43 } 44 ); 45}