Skip to content

Instantly share code, notes, and snippets.

@miguelkashir
Last active July 31, 2022 16:43
Show Gist options
  • Save miguelkashir/e86f2f896370d7da64d6539eb492d4c0 to your computer and use it in GitHub Desktop.
Save miguelkashir/e86f2f896370d7da64d6539eb492d4c0 to your computer and use it in GitHub Desktop.
Linux - Use Caps Lock + HJKL as arrow keys

Step 0 : install xclip and xcape

sudo apt install xclip xcape

Step 1 : create ~/.xmodmap

Copy the following text:

keycode 66 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down

Create file with contents:

touch ~/.xmodmap
xclip -o > ~/.xmodmap

Step 2 : create script

Copy the following text:

xmodmap ~/.xmodmap
xcape -e 'Mode_switch=Escape'

Create file with contents:

touch ~/xmodmap.sh
xclip -o > ~/xmodmap.sh

Make file executable:

chmod +x ~/xmodmap.sh

Step 3 : create autostart entry

Copy the following text:

[Desktop Entry]
Type=Application
Exec=sh -c "$HOME/xmodmap.sh"
Hidden=false
X-GNOME-Autostart-enabled=true
Name=xmodmap
Comment=xmodmap script

Create file with contents:

touch ~/.config/autostart/xmodmap.desktop
xclip -o > ~/.config/autostart/xmodmap.desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment