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

169 lines
8.1 KiB
Nix
Raw Normal View History

2024-10-15 02:40:43 -04:00
{ pkgs, config, ... }:
2024-10-09 03:36:08 -04:00
{
2024-11-07 18:17:51 -05:00
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
2024-11-19 13:20:34 -05:00
"${primeMod}+s" = ''exec rofi -show run -p Command'';
2024-11-07 18:17:51 -05:00
"${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'';
2024-11-07 18:17:51 -05:00
# Mod + shift + key
2024-11-19 13:20:34 -05:00
"${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'';
2024-11-07 18:17:51 -05:00
"${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"'';
2024-11-07 18:17:51 -05:00
## Media
2024-11-07 18:17:51 -05:00
# Volume
2024-11-07 18:17:51 -05:00
"${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'';
"${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+'';
# MPD
2024-11-07 18:17:51 -05:00
"${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
2024-11-07 18:17:51 -05:00
# Notifications
2024-11-07 18:17:51 -05:00
"${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'';
2024-11-07 18:17:51 -05:00
# Display and keyboard brightness
2024-11-07 18:17:51 -05:00
"${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
2024-11-07 18:17:51 -05:00
"${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}'';
2024-11-07 18:17:51 -05:00
# 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}'';
2024-11-07 18:17:51 -05:00
# 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}'';
2024-11-07 18:17:51 -05:00
# 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}'';
2024-11-07 18:17:51 -05:00
# Change focused window
2024-11-07 18:17:51 -05:00
"${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'';
2024-11-07 18:17:51 -05:00
# 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
2024-11-13 09:43:47 -05:00
"Shift+Ctrl+Backslash" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888'';
2024-11-07 18:17:51 -05:00
"${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'';
2024-08-24 22:16:51 -04:00
};
};
}