this post was submitted on 07 Apr 2025
21 points (88.9% liked)

Linux

52850 readers
2258 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I use i3wm, and to map cap lock to escape, I run:

setxkbmap -option caps:swapescape

This works fine, but sometimes while hitting the F1 key, my pinky can accidentally hit the Escape key, which turns on CapsLock.

Gnome has a very nice way to do this, where Shift + Escape = CapsLock. Hitting Escape on its own will do nothing.

you are viewing a single comment's thread
view the rest of the comments
[–] degen@midwest.social 1 points 13 hours ago* (last edited 13 hours ago)

I use keyd for software remapping now, and I like it a lot more than xkb's esoteric options. It has functionality for layers like layer:C, where any "passthrough" input will have the defined modifier (or combo like C-S-M), but you can define whatever other bindings inside.

Long story short, I've used it to remap caps, control, shift (with a custom shift layer for some symbols), and meta, with overloads, double tap/hold into layers, oneshots, timeouts, and all sorts of (surprisingly fluid) nonsense. It's so much easier than wading through xkb options for me.

To sidestep the question slightly less, I always got rid of capslock altogether instead of swapping. That still leaves true escape to be hit accidentally, but I think there should be an option to change escape too?

Edit: what I always used was

# make CapsLock behave like Ctrl:
setxkbmap -option ctrl:nocaps

# make short-pressed Ctrl behave like Escape:
xcape -e 'Control_L=Escape'

from here