hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.7K
active users

Simon Tatham

I never use Caps Lock, so I disable the Caps Lock key completely with xmodmap, to avoid hitting it by accident.

Occasionally my X server gets into caps-lock state anyway. (Usually some complicated stunt was involved, like attaching x11vnc to the display remotely.) And then I can't turn it off again using the Caps Lock key.

So I wrote a tiny X client that lets me type 'xcapslock off' at a shell prompt …

… and then I had to make an alias to it, called 'XCAPSLOCK OFF'.

@simontatham I modified my keymap so that I have to press shift+capslock (or shift+numlock) to lock/unlock them. So, no accidental triggering anymore, but I can still use it if I really want to

@pulkomandy neat – I don't know how to do that, on any OS. On X11 (which I know best) I'm 75% sure there's no way to do it with plain xmodmap, but maybe the richer XInput API has a way?

@simontatham I have this for numlock but I'm not entirely sure of what it does:

xmodmap -e 'keycode 77 = NoSymbol Num_Lock'

I didn't try caps lock yet, does it not have a keycode, or would it just be confused about shift?

@pulkomandy aha, nice! Generally 'keycode K = a b c d' means that K generates symbol a unshifted, b shifted, and I think c with AltGr and d with both modifiers.

xmodmap -e 'keycode 66 = NoSymbol Caps_Lock' is the Caps Lock equivalent of your Num Lock line. So I was wrong (or perhaps '25% wrong' :-). You _can_ do it with plain xmodmap.

@simontatham @pulkomandy the Japanese keymap has that by default (without Shift it's part of Japanese IME, with Shift it's CapsLock), so that would be a good starting point to see how it's done in different systems.

@simontatham I simply remove the capslock key from every keyboard I ever have to use more than once.

@simontatham I have mapped it to a weird key combination for that reason, that I have to look up everytime this happens.

@simontatham Caps Lock becomes Escape for me on any machine I spend any time on.

@alexanderdyas since my previous view of Caps Lock was 'that key I used to keep hitting by accident', I never quite felt it would be a good idea to remap it to any actual action, even a more useful one :-)

@simontatham @alexanderdyas it makes using vim great to have caps lock mapped to escape.

@simontatham Just start all your terminals with `stty iuclc`.

(A joke.)

@simontatham I may have some aliases along those lines.

alias nordconnect="nordvpn connect"

@simontatham interesting, I’ve never seen that in over 20 capslockless years… but I don’t attach x11vnc.

If you just need "a" remote seesion but not necessarily attach to th currently running session, I can recommend xrdp+xorgxrdp on the server side, and rdesktop or some other RDP client to connect. It also has keymap issues, but slight (basically, I need to revert to the default US layout without my customisations outside if I want to use similar xmodmap effects inside, and inside it uses the older XFree86 / pre-evdev Xorg keycodes).

@simontatham I think I'd alias it to something like BOY, I SAY, BOY.

@simontatham it's funny, was trying to figure out how to do this in Mac and it's not obvious, but one could create a tiny USB hardware device that would declare itself a keyboard, but all it would ever do is toggle caps lock off whenever it sees it go on.

@kacey @simontatham I use the Hyperkey app to rebind capslock as shift+ctrl+alt+mod. Then I use it for Raycast shortcuts.

@simontatham I have "x11vnc -display :0 -auth /var/run/lightdm/root/\:0 -R clear_all" in my bash history on soooo many VMs now.

@simontatham I actually use and like to have Caps Lock.

But I believe the Debian installer still contains a change I made when I discovered that the Brazilian Portuguese keyboard layout has 106 keys, and / is on the 106th key - so I had to be able to switch out of it manually without needing to type any absolute paths!

@simontatham I was going to suggest the built-in xkbmap option to turn LShift+RShift into Caps for such situations (as I usually run with -option compose:caps, it goes well with -option shift:both_capslock)...

Something else, vaguely similar, used to happen for me when I was doing nested RDP connections from Linux – FreeRDP into a VM host, then console into a VM – the X server would sometimes get stuck thinking a nonexistent /Shift/ key was pressed, just from watching a VM boot. What really made it weird is that it wasn't in Caps mode, as even holding physical Shift wouldn't return to lowercase (as normally would with Caps + Shift); it was as if I had a third Shift key stuck.

I could never figure out any any way to undo that, short of restarting the entire X server. Perhaps fortunately, Xwayland seems to be more resilient to that (and less impactful to restart anyway).

@simontatham@hachyderm.io I remapped mine to <compose>, which is occasionally useful and a lot less annoying when you aim for the <a> mid-sentence and miss.
I then mapped both-shift-keys-at-the-same-time to toggle capslock, for the occasional moment when I WANT TO TALK LIKE AN ANTHROPOMORPHIC PERSONIFICATION.

As this is Linux, I've long since forgotten how I achieved either of these things.

@simontatham I always remap Caps Lock -> Control which helps for Emacs key bindings

@simontatham Apparently 1 in every 15200 keys I press on this laptop is capslock. 1 in 30400 of course, because of the toggling. Still higher than I'd expect. Recorder is at github.com/ralight/keycounts

GitHubGitHub - ralight/keycountsContribute to ralight/keycounts development by creating an account on GitHub.

@simontatham you don't really need the *lowercase* version of it, I guess! :)

Hm. Now wondering if you can bind capslock to "capslock off" for maximum "do what you want" :)

@jackv ha, true, I could have made "xcapslock" implicitly mean "on", and "XCAPSLOCK" mean "off"!

@simontatham Exactly! I'm sure that's a horrible mistake SOMEHOW but I can't think why :)

@jackv I think two reasons:

1. It assumes the _only_ use for the 'xcapslock' tool is to use it interactively on the command line. As soon as you find a use for the same tool in a script, you'll wish the syntax was more logical.

2. When you add the companion tool 'xnumlock', which has no analogous spelling variation in the command itself, you'll want both tools to have the same command-line syntax.

@simontatham Interesting. I have the caps lock key bound to compose in my GNOME session and it’s never been an issue for me, not when I used X and not now when I use Wayland.

@simontatham Although I did not manually tinker with any of the X keymap stuff. I just set compose:caps in the xkb options…

@simontatham I've ended up rebinding it to F13 which I then use as push to talk in various voice call applications. Works really well and doesn't clash with anything else.

@simontatham I remapped it to backspace.
Works great on my PC, but correcting typos on other computers now takes 5x as long.

@rigrig @simontatham The brain takes a bit longer to be remapped🥲

@simontatham I usually xmodmap Caps Lock to ctrl. Which has way better ergonomics.

Though you will still need a tool like you describe.

@simontatham I do something similar and named my script HELP

@simontatham I HAVE ONLY COME HERE TO SEE IF ALL YOUR REPLIES ARE IN CAPS LOCK.

@DevlinLeathercraft IN THAT CASE YOU MUST HAVE BEEN TERRIBLY DISAPPOINTED! HERE, HAVE SOME BELLOWING.

@simontatham I set `capswapescape` instead

@simontatham My situation is remarkably similar. I also use xmodmap but I remap caps lock to the windows key and use it as a meta key with i3wm. I found when I use Remmina for RDP I often end up toggling caps lock somehow by accident. I suspect that when I'm inside the RDP session I use capslock to switch i3 work spaces and it must toggle caps lock at the same time while in the session. But somehow it also toggles on my host. I also made an alias `fixcapslock` that toggles it back off again.

@simontatham
How about a (soft) link in bin and doing a toLower() on the arguments?
Or no arguments and checking argv[0]s capitalization?
OK, i ges that is more work than an alias.

@simontatham Get a USB foot pedal and map it to caps-lock.

@krh if I had one of those, it would be mapped to 'mute' in voice calling applications! 'Sneeze pedal'.

@krh @simontatham I love the "any of your feet" phrasing, just so as to be inclusive of hexapodia.