NixOS-Config/modules/home/wms/sway/hotkeys/default.nix

169 lines
8.1 KiB
Nix

{ pkgs, config, ... }:
{
wayland.windowManager.sway.config = let
# Set default modifier and variables
primeMod = "Mod4";
secMod = "Mod1";
resizeAmount = "55";
in {
# Hotkeys
modifier = "${primeMod}";
keybindings = {
## Launchers
# Browser profiles
"${primeMod}+F1" = ''exec librewolf -p Main --name MainBrowser | notify-send "Main Browser"'';
"${primeMod}+F2" = ''exec librewolf -p Alt --name AltBrowser | notify-send "Alternate Browser"'';
"${primeMod}+F3" = ''exec librewolf -p Misc --name MiscBrowser | notify-send "Miscellaneous Browser"'';
# Virtual machines
"${primeMod}+F4" = ''exec virt-manager | notify-send "Virtual Machines"'';
"${primeMod}+F5" = ''exec looking-glass-client input:rawMouse=yes | notify-send "Looking Glass"'';
# Mod + key
"${primeMod}+s" = ''exec rofi -show run -p Command'';
"${primeMod}+c" = ''exec clipman pick -t rofi'';
"${primeMod}+x" = ''exec rofiscripts --power'';
"${primeMod}+b" = ''exec pkill -USR1 waybar'';
"${primeMod}+Return" = ''exec foot'';
"${primeMod}+Escape" = ''exec tools-sway --kill'';
# Mod + shift + key
"${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history'';
"${primeMod}+Shift+t" = ''exec pcmanfm'';
"${primeMod}+Shift+e" = ''exec bemoji -n -P 0'';
"${primeMod}+Shift+b" = ''exec rofi-bluetooth'';
"${primeMod}+Shift+Return" = ''exec foot ranger'';
# Mod + ctrl + key
"${primeMod}+Ctrl+x" = ''exec tools-sway --prop'';
"${primeMod}+Ctrl+s" = ''exec rofiscripts --scratchpads'';
"${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"'';
## Media
# Volume
"${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'';
"${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+'';
# MPD
"${primeMod}+Backslash" = ''exec mpc toggle'';
"${secMod}+Shift+h" = ''exec mpc prev'';
"${secMod}+Shift+j" = ''exec mpc volume -3'';
"${secMod}+Shift+k" = ''exec mpc volume +3'';
"${secMod}+Shift+l" = ''exec mpc next'';
## Miscellaneous
# Notifications
"${primeMod}+n" = ''exec makotoggle'';
"${primeMod}+Shift+n" = ''exec makoctl restore'';
"${primeMod}+Ctrl+n" = ''exec makoctl dismiss -a'';
# Screenshots
"${secMod}+f" = ''exec screen-sway --swappy'';
"${secMod}+Shift+f" = ''exec screen-sway --screen'';
# Display and keyboard brightness
"${primeMod}+equal" = ''exec light -A 5'';
"${primeMod}+minus" = ''exec light -U 5'';
"${primeMod}+Shift+equal" = ''exec light -A 1'';
"${primeMod}+Shift+minus" = ''exec light -U 1'';
"XF86KbdBrightnessUp" = ''exec light -s sysfs/leds/smc::kbd_backlight -A 5'';
"XF86KbdBrightnessDown" = ''exec light -s sysfs/leds/smc::kbd_backlight -U 5'';
## Window manager
"${primeMod}+q" = ''kill'';
"${primeMod}+Shift+r" = ''reload'';
# Switch to workspaces
"${primeMod}+grave" = ''workspace 0:${config.ws.w0}'';
"${primeMod}+1" = ''workspace 1:${config.ws.w1}'';
"${primeMod}+2" = ''workspace 2:${config.ws.w2}'';
"${primeMod}+3" = ''workspace 3:${config.ws.w3}'';
"${primeMod}+4" = ''workspace 4:${config.ws.w4}'';
"${primeMod}+5" = ''workspace 5:${config.ws.w5}'';
"${primeMod}+6" = ''workspace 6:${config.ws.w6}'';
"${primeMod}+7" = ''workspace 7:${config.ws.w7}'';
"${primeMod}+8" = ''workspace 8:${config.ws.w8}'';
"${primeMod}+9" = ''workspace 9:${config.ws.w9}'';
# Switch to alternate workspaces
"${secMod}+F1" = ''workspace 11:${config.ws.w1a}'';
"${secMod}+F2" = ''workspace 22:${config.ws.w2a}'';
"${secMod}+F3" = ''workspace 33:${config.ws.w3a}'';
"${secMod}+F4" = ''workspace 44:${config.ws.w4a}'';
"${secMod}+F5" = ''workspace 55:${config.ws.w5a}'';
"${secMod}+F6" = ''workspace 66:${config.ws.w6a}'';
"${secMod}+F7" = ''workspace 77:${config.ws.w7a}'';
"${secMod}+F8" = ''workspace 88:${config.ws.w8a}'';
"${secMod}+F9" = ''workspace 99:${config.ws.w9a}'';
# Move window to and focus workspace
"${primeMod}+Shift+grave" = ''move container to workspace 0:${config.ws.w0}; workspace 0:${config.ws.w0}'';
"${primeMod}+Shift+1" = ''move container to workspace 1:${config.ws.w1}; workspace 1:${config.ws.w1}'';
"${primeMod}+Shift+2" = ''move container to workspace 2:${config.ws.w2}; workspace 2:${config.ws.w2}'';
"${primeMod}+Shift+3" = ''move container to workspace 3:${config.ws.w3}; workspace 3:${config.ws.w3}'';
"${primeMod}+Shift+4" = ''move container to workspace 4:${config.ws.w4}; workspace 4:${config.ws.w4}'';
"${primeMod}+Shift+5" = ''move container to workspace 5:${config.ws.w5}; workspace 5:${config.ws.w5}'';
"${primeMod}+Shift+6" = ''move container to workspace 6:${config.ws.w6}; workspace 6:${config.ws.w6}'';
"${primeMod}+Shift+7" = ''move container to workspace 7:${config.ws.w7}; workspace 7:${config.ws.w7}'';
"${primeMod}+Shift+8" = ''move container to workspace 8:${config.ws.w8}; workspace 8:${config.ws.w8}'';
"${primeMod}+Shift+9" = ''move container to workspace 9:${config.ws.w9}; workspace 9:${config.ws.w9}'';
# Move window to and focus alternate workspace
"${secMod}+Shift+F1" = ''move container to workspace 11:${config.ws.w1a}; workspace 11:${config.ws.w1a}'';
"${secMod}+Shift+F2" = ''move container to workspace 22:${config.ws.w2a}; workspace 22:${config.ws.w2a}'';
"${secMod}+Shift+F3" = ''move container to workspace 33:${config.ws.w3a}; workspace 33:${config.ws.w3a}'';
"${secMod}+Shift+F4" = ''move container to workspace 44:${config.ws.w4a}; workspace 44:${config.ws.w4a}'';
"${secMod}+Shift+F5" = ''move container to workspace 55:${config.ws.w5a}; workspace 55:${config.ws.w5a}'';
"${secMod}+Shift+F6" = ''move container to workspace 66:${config.ws.w6a}; workspace 66:${config.ws.w6a}'';
"${secMod}+Shift+F7" = ''move container to workspace 77:${config.ws.w7a}; workspace 77:${config.ws.w7a}'';
"${secMod}+Shift+F8" = ''move container to workspace 88:${config.ws.w8a}; workspace 88:${config.ws.w8a}'';
"${secMod}+Shift+F9" = ''move container to workspace 99:${config.ws.w9a}; workspace 99:${config.ws.w9a}'';
# Change focused window
"${primeMod}+h" = ''focus left'';
"${primeMod}+j" = ''focus down'';
"${primeMod}+k" = ''focus up'';
"${primeMod}+l" = ''focus right'';
# Move focused window
"${primeMod}+Shift+h" = ''move left ${resizeAmount} px'';
"${primeMod}+Shift+j" = ''move down ${resizeAmount} px'';
"${primeMod}+Shift+k" = ''move up ${resizeAmount} px'';
"${primeMod}+Shift+l" = ''move right ${resizeAmount} px'';
# Resize window
"${primeMod}+${secMod}+h" = ''resize shrink width ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+j" = ''resize shrink height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+k" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${secMod}+l" = ''resize grow width ${resizeAmount} px or 5 ppt'';
# Change focus between floating/tiled, toggle floating
"${primeMod}+space" = ''focus mode_toggle'';
"${primeMod}+Shift+space" = ''floating toggle'';
# Toggle fullscreen
"${primeMod}+f" = ''fullscreen toggle'';
"${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global'';
# Change container layout
"${primeMod}+w" = ''layout toggle split'';
"${primeMod}+e" = ''layout toggle tabbed stacking'';
# Change split direction
"${primeMod}+v" = ''split v'';
# Focus parent / child
"${primeMod}+a" = ''focus parent'';
"${primeMod}+shift+a" = ''focus child'';
# Scratchpads
"${primeMod}+Shift+Backslash" = ''[app_id="btop"] scratchpad show, move position center, resize set 1216 888'';
"${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657'';
"${primeMod}+Shift+v" = ''[app_id="sound"] scratchpad show, move position center, resize set 1000 800'';
};
};
}