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've taken to solving this one layer below: you can mess with the event system to remap keys even before X ever sees them. Additional benefit is that they're remapped even on the console.
The downside is that you might have to do this for every keyboard you have on the system, as they don't necessarily agree on the low level key codes. Specifically the built-in laptop keyboard usually doesn't use USB key codes.

@Lalufu I must admit that I also cling to an old-fashioned idea that computers are still multi-user. Even my personal ones: I have been known to give other people accounts on them, and when those people use their accounts, they _don't_ want the effects of bizarre things like this intended for just me.

So I still think it makes more sense to put my preferences in my account, not systemwide. This is also a reason I haven't taken the Caps Lock keycap off.

@simontatham Fair point.

@Lalufu though admittedly one flaw in this concept is the login screen. If I have a preferred keyboard layout that's not the systemwide one, I'd like to use it to type my password – especially since I'll _also_ sometimes need to type my password after logging in, and it's doubly annoying to do it in two different finger shapes!

I don't know if any login-screen software temporarily enables each user's keyboard preferences for their password prompt. Or even if it _could_, securely.

@simontatham @Lalufu I think I’ve seen it done, with a display manager (can’t remember which) maintaining a cache of preferred session type and keyboard layout for each username.

@simontatham @Lalufu I finally gave up on the whole "even my PC is multi-user" on the latest install, and it's such a nice experience. I highly recommend it, if you can. I still have a shortcut to map my keyboard back to querty, for when someone needs to type something, but I'm not setting up any accounts.

MS Windows switches layout for different users. I would be surprised if there aren't one like it available for other OSs too, but I never checked.