Skip to content

Easy Caps Lock Remapping for PopOS

I never use the Caps Lock as intended and the key's prime real estate right next to my pinky seems to be wasted as it stands by default. My external keyboard runs QMK and has Caps Lock mapped to post Escape on release, and vim hjkl as arrow keys when held.

When I am using a laptop I often want the built in keyboard to act similarly which means I need to implement it on the OS.

Here is the best solution I have found for PopOS.

1. Install xcape

$ sudo apt-get install xcape

2. xmodmap config

~/.xmodmap

keycode 66 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
keysym u = u U Prior
keysym i = i I Home
keysym o = o O End
keysym p = p P Next

3. Set up the Startup Application

Edit the following file which will load xmodmap and run xcape in the proper order on boot.

~/.config/autostart/capslock.desktop

[Desktop Entry]
Type=Application
Exec=bash -c "xmodmap ~/.xmodmap && xcape -t 180 -e 'Mode_switch=Escape'"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=Caps Lock to escape hjkl
Name=xcape
Comment[en_US]=
Comment=