Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capslock-nodelay

Make Caps Lock toggle instantly on Linux, without the infamous delay, and without the popular xkb file hack that can leave keys stuck autorepeating.

The problem

On Linux (X11 and most xkb-based setups), turning Caps Lock off only takes effect when you physically release the key. If you type fast, your finger is often still on Caps Lock when you hit the next letter, so that letter comes out in the wrong case. To a fast typist this feels like Caps Lock "lags" by one keystroke.

The popular fix, and why you should not use it

A widely shared solution (for example this Ask Ubuntu answer, based on a Manjaro forum post) edits /usr/share/X11/xkb/symbols/capslock, replacing the ctrl_modifier section with a custom key definition that uses LockMods(modifiers=Shift+Lock, affect=unlock) to apply the unlock on key press.

It does remove the delay, but the lock-state juggling can desync the X server's autorepeat state: a key release event gets eaten while the lock state flips, and the key (space, for example) keeps repeating forever until you press it again. It also gets silently overwritten whenever your distro updates xkb-data.

What this project does instead

It uses keyd, a kernel-level key remapping daemon, with a two-line idea:

[main]
capslock = macro(capslock)

When you press Caps Lock, keyd immediately emits a synthetic press and release of the key. The release arrives before your next letter no matter how fast you type, so the xkb "unlock on release" rule fires instantly. You keep 100% real Caps Lock semantics: letters only, correct locale behavior (Turkish İ/I works), LED indicator, everything.

A macro_timeout guard makes sure holding the key down does not re-toggle it.

Because keyd works below the display server, this also works on Wayland.

Install

git clone https://github.com/wleeaf/capslock-nodelay
cd capslock-nodelay
./install.sh

The script:

  1. Installs keyd (from your package manager if available, otherwise builds it from source; source build needs git, make, gcc).
  2. Detects and reverts the xkb capslock file hack if you applied it (on Debian/Ubuntu it reinstalls xkb-data).
  3. Removes leftover caps:* options from GNOME's xkb-options (the old hack required setting "Caps Lock is also a Ctrl" in Tweaks).
  4. Installs the keyd config (backing up any existing /etc/keyd/default.conf to default.conf.bak) and enables the keyd service.

Uninstall

./uninstall.sh

Restores your previous keyd config if one was backed up, otherwise removes the config and stops keyd.

Manual setup

If you already run keyd, just merge keyd/default.conf into your config and run sudo keyd reload.

Tested on

Zorin OS 17 (Ubuntu 24.04 base, GNOME, X11), keyd v2.6.0. Should work on any systemd distro keyd supports, on X11 or Wayland.

License

MIT

About

Instant Caps Lock toggle on Linux via keyd: kills the unlock delay without the xkb file hack that causes stuck keys

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages