From e763ff8c1d7e14900c5fcccddeb4fea0c56c682e Mon Sep 17 00:00:00 2001 From: Jimbo Date: Thu, 24 Oct 2024 19:44:44 -0400 Subject: [PATCH] Disable arrow keys and move to Vi keys. --- modules/home/sway/hotkeys/default.nix | 55 ++++++++++----------- modules/system/services/pc/keyd/default.nix | 22 +++++++-- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/modules/home/sway/hotkeys/default.nix b/modules/home/sway/hotkeys/default.nix index c834374..153a69e 100644 --- a/modules/home/sway/hotkeys/default.nix +++ b/modules/home/sway/hotkeys/default.nix @@ -95,15 +95,15 @@ ## Media keys # Volume control - "${secMod}+Up" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+''; - "${secMod}+Down" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-''; + "${secMod}+j" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-''; + "${secMod}+k" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+''; # MPD Controls "${primeMod}+Backslash" = ''exec mpc toggle''; - "${secMod}+Shift+Up" = ''exec mpc volume +3''; - "${secMod}+Shift+Down" = ''exec mpc volume -3''; - "${secMod}+Shift+Right" = ''exec mpc next''; - "${secMod}+Shift+Left" = ''exec mpc prev''; + "${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''; ## Notification keys @@ -180,26 +180,32 @@ "${secMod}+Shift+F9" = ''move container to workspace ${config.ws.w9a}; workspace ${config.ws.w9a}''; # Change focus across windows - "${primeMod}+Up" = ''focus up''; - "${primeMod}+Down" = ''focus down''; - "${primeMod}+Left" = ''focus left''; - "${primeMod}+Right" = ''focus right''; + "${primeMod}+h" = ''focus left''; + "${primeMod}+j" = ''focus down''; + "${primeMod}+k" = ''focus up''; + "${primeMod}+l" = ''focus right''; - # Switch focus across config - "${primeMod}+j" = ''focus output ${config.displays.d2}''; - "${primeMod}+k" = ''focus output ${config.displays.d1}''; - "${primeMod}+l" = ''focus output ${config.displays.d3}''; + # Resize windows + "${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''; # Move focused window - "${primeMod}+Shift+Up" = ''move up ${resizeAmount} px''; - "${primeMod}+Shift+Down" = ''move down ${resizeAmount} px''; - "${primeMod}+Shift+Left" = ''move left ${resizeAmount} px''; - "${primeMod}+Shift+Right" = ''move right ${resizeAmount} px''; + "${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''; + + # Switch focus across config + "${primeMod}+i" = ''focus output ${config.displays.d2}''; + "${primeMod}+o" = ''focus output ${config.displays.d1}''; + "${primeMod}+p" = ''focus output ${config.displays.d3}''; # Move window across config - "${primeMod}+Shift+j" = ''move output ${config.displays.d2}; focus output ${config.displays.d2}''; - "${primeMod}+Shift+k" = ''move output ${config.displays.d1}; focus output ${config.displays.d1}''; - "${primeMod}+Shift+l" = ''move output ${config.displays.d3}; focus output ${config.displays.d3}''; + "${primeMod}+Shift+i" = ''move output ${config.displays.d2}; focus output ${config.displays.d2}''; + "${primeMod}+Shift+o" = ''move output ${config.displays.d1}; focus output ${config.displays.d1}''; + "${primeMod}+Shift+p" = ''move output ${config.displays.d3}; focus output ${config.displays.d3}''; # Change focus between floating/tiled, toggle floating "${primeMod}+space" = ''focus mode_toggle''; @@ -217,19 +223,12 @@ "${primeMod}+e" = ''layout toggle tabbed stacking''; # Change split direction - "${primeMod}+h" = ''split h''; "${primeMod}+v" = ''split v''; # Focus parent / child "${primeMod}+a" = ''focus parent''; "${primeMod}+shift+a" = ''focus child''; - # Resize windows - "${primeMod}+${secMod}+Up" = ''resize grow height ${resizeAmount} px or 5 ppt''; - "${primeMod}+${secMod}+Down" = ''resize shrink height ${resizeAmount} px or 5 ppt''; - "${primeMod}+${secMod}+Left" = ''resize shrink width ${resizeAmount} px or 5 ppt''; - "${primeMod}+${secMod}+Right" = ''resize grow width ${resizeAmount} px or 5 ppt''; - # Scratchpads "Shift+Ctrl+Delete" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888''; "${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657''; diff --git a/modules/system/services/pc/keyd/default.nix b/modules/system/services/pc/keyd/default.nix index a7f23b0..6840f86 100644 --- a/modules/system/services/pc/keyd/default.nix +++ b/modules/system/services/pc/keyd/default.nix @@ -4,11 +4,23 @@ enable = true; keyboards.default = { ids = [ "*" ]; - settings.main = { - capslock = "overload(control, esc)"; - esc = "capslock"; - control = "f14"; - scrolllock = "esc"; + settings = { + main = { + capslock = "overload(control,esc)"; + esc = "capslock"; + rightcontrol = "esc"; + leftcontrol = "noop"; + left = "noop"; + down = "noop"; + up = "noop"; + right = "noop"; + }; + control = { + h = "left"; + j = "down"; + k = "up"; + l = "right"; + }; }; }; };