Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » [Linux] How to Change the Caps-Lock Behaviour

This thread is locked; no one can reply to it. rss feed Print
[Linux] How to Change the Caps-Lock Behaviour
Bernardo Lopes
Member #7,318
June 2006
avatar

Every Linux flavour gives me this issue:

The Caps-Lock key, that I use to capitalise sentences, only toggles the capitalisation modifier when I release said key.

Instead, I want it to toggle (and lock) the capitalisation modifier when I simply press the key, disregarding if I ever release said key.

That's the behaviour of Windows.

I don't use the Shift key because I learned how to type relying on the Caps-Lock key to those jobs. I don't intend to re-learn how to type unless I have absolutely no way around this.

I tend to hold the Caps key a little longer on some sentences, thus outputing this:

"THis IS AN EXample SEntence".

Obviously I posted this on the Ubuntu Forums (since that's the distro I use).

The original post is here: How to Change Caps Lock Behavior

But so I far I failed to find a fix.

If you guys have something to say to help me, please do.

Thanks.

SiegeLord
Member #7,827
October 2006
avatar

This appears to be a bug, actually, as it is inconsistent. When you start in a capslock off state, and then press capslock, the letters start getting capitalized. When you are in capslock on state, and then press capslock, nothing happens. Only when you release capslock in the second scenario do the letters go back to normal. Either the state change should be dependent on the KEY_PRESSED event in both cases, or on KEY_RELEASED in both cases, not one or the other depending on the current state.

I guess you'd need to find whatever is responsible for keyboard input (Xorg?) and submit a bug report. Alternatively, someone could look at the driver and see if it can be fixed manually so you can recompile it for your system.

EDIT: Just tested it, and the same inconsistency happens with Num lock.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Bernardo Lopes
Member #510
July 2000
avatar

SiegeLord you seemed to have nailed it exactly!

Summarising all the Ubuntu thread in a single post.

Maybe I should do that as you described but I'll refrain to tag it as a "bug" yet.

I'm fairly new to Linux so I don't know how accessible/simple is to simply pick-up the corresponding piece of code, try to change it and recompile.

Do you have any pointers on that? Or maybe it's way out of my league.

Anyway I'll look into the responsible party that deals with keyboard.

Thanks.

[edit]
Not related to this topic: I have two profiles and would like to request that Mr. Leverton deactivates the latter one (2006) so I could stop confusing myself and others.

kazzmir
Member #1,786
December 2001
avatar

It works for me in aterm although it doesn't work in firefox (I mean I get the behavior you describe in firefox). So maybe your bug should be sent to firefox and not xorg?

I'm fairly sympathetic to typing issues even if they are different from my own but I really don't see the point of using capslock to capitalize single letters. Thats exactly what shift is for. I mean it sounds like how you would type 'The' is

press caps
press T
press caps again and maybe leave it down
press H
press E

It seems much easier to me to type

press shift
press T
release shift
press H
press E

I could see how you might leave your finger pressed on the shift key, thus capitalizing H but you are already doing extra work by pressing caps again so it seems strange.

Matthew Leverton
Supreme Loser
January 1999
avatar

I'd file this bug under the "Keyboard to Chair Interface Failure" category.

Bernardo Lopes
Member #510
July 2000
avatar

Yes kazzmir, the first one is what I do.

I know that the vast majority of people find this awkward.

I'm just saying that I learned how to type without following any formal method, thus acquiring the bad habit of overusing the Caps-Lock key.

The fact that I have been discriminated with the use of sarcastic humor and some angry posts is very peculiar. I didn't knew it was a subject that touched people passions towards OSes or that made me look intellectually handicapped.

And I'm not saying that Linux should accommodate this.

I only asked if there was a way to change that behaviour.

The answers were: "file a bug to the proper keyboard related party, or patch/wrap the kernel keyboard code to your likings and rebuild" and "Learn how to type the proper way".

Thanks for the help guys.

kazzmir
Member #1,786
December 2001
avatar

I'm just saying that I learned how to type without following any formal method, thus acquiring the bad habit of overusing the Caps-Lock key.

Self-pity won't win you any points. I wasn't taught formally either, I just do whatever comes naturally. Pressing the caps-lock key might come naturally for you as well, I was just commenting that its very strange that it would come naturally at all considering how much harder it is to press caps-lock twice than it is to hit shift once.

Anyway, have you determined if its application specific or does it happen everywhere? You can probably just remap caps-lock to shift using xmodmap.

SiegeLord
Member #7,827
October 2006
avatar

For me I get the bad behaviour in every application I tested (including aterm).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Thomas Fjellstrom
Member #476
June 2000
avatar

I wouldn't call it "bad". Caps lock is a SWITCH not a regular button. Its state toggles. Why in heck you'd expect it to act like SHIFT I'll never know.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Timorg
Member #2,028
March 2002

I just tested it with ubuntu, under X.Org and by switching to an actual console. Under X it doesn't revert to normal caps until the button is released. Under the console, it behaves as it does in windows, so its an X.Org behavour.

I do find how you type a little odd, as the T, A, E & S are all usually typed using the right shift key. Caps-lock->A->Caps-lock is a lot more work than right shift+A. But if its the way you want to type, so be it.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Arthur Kalliokoski
Second in Command
February 2005
avatar

Why would you hold down a shift lock? Just a quick peck with your pinky and you're done.

They all watch too much MSNBC... they get ideas.

Timorg
Member #2,028
March 2002

If I was going to look at fixing the problem, I look at any code that does something like PostEvent(pInfo, KEY_CapsLock, TRUE) function in kbd.c or maybe other X.Org sources.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

BAF
Member #2,981
December 2002
avatar

I hardly EVER use my right shift key. In fact, I mainly use it just for playing games. Capital A, E, S, etc I use left shift for too. Shift with right pinky, index finger for T, ring finger for A, and middle finger for E and S.

bamccaig
Member #7,536
July 2006
avatar

Bernardo Lopes
Member #510
July 2000
avatar

kazzmir said:

Self-pity won't win you any points.

I had to look the expression "self-pity" on Google to understand it.

If I understand correctly it was an insult.

You've interpreted my post the wrong way. I wrote in an impartial way, only describing the scenario for you guys information.

Re-reading my post again I think that starting the sentence with "I'm just saying" made me sound that way.

kazzmir said:

Anyway, have you determined if its application specific or does it happen everywhere?

Happens in every application that I've used.

I'm taking a touch-typing tutorial to overcome my disability.

bamccaig
Member #7,536
July 2006
avatar

I'm taking a touch-typing tutorial to overcome my disability.

It's not a disability. Just a quirk. ;) I would expect you to find it easier once you learn to use shift, but who knows... :)

Simon Parzer
Member #3,330
March 2003
avatar

Well, X.org had the same problem concerning the SHIFT key. If you'd do the following:

Press c
Release c
Press d
Release d
Press space
Press shift
Release space
Press 7 (shift still pressed)

it would result in 'cd 7', where I was obviously trying to type 'cd /'. Took them several months to fix it.
Anyway - the problem you are describing is a real bug nevertheless, even if no one cares about it. I have a LED for caps lock (most of you do), and as soon as I press capslock the second time, the LED turns off, even if caps lock is still pressed. So you can type upper case letters even if the caps lock LED is off and shift is not pressed. I would post that somewhere on https://bugs.freedesktop.org/

bamccaig
Member #7,536
July 2006
avatar

Clearly your keyboard is different from mine because for me, the '/' (and '?') key is next to right-shift whereas shifted '7' results in '&'. I know that on my Eee PC 1000, which tries to support Chinese typing out of the box, it freaks out when I hit space while holding the shift key. It changes the keyboard configuration automatically and results in really awkward output. It was very alarming when I didn't know why it was doing that. Perhaps something similar is happening for you?

You might want to look into your keyboard configuration (i.e., which keyboard is selected and what kinds of configuration options are available). Clearly if shift is down when you press the '7' key it should result in the shifted key press unless something changes when you press shift+space.

relpatseht
Member #5,034
September 2004
avatar

I never thought I'd know of two people with that particular quirk.

MiquelFire
Member #3,110
January 2003
avatar

Simon, what type of keyboard do you have?

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

SiegeLord
Member #7,827
October 2006
avatar

I wouldn't call it "bad".

It's bad because it is inconsistent, no matter what people use it for. Either the key press should reset the state, or key release should reset the state, not one or another at differing times. Plus, as the OP said, this also leads to the mismatch between the actual Caps Lock state and the Caps Lock LED and which does get reset by the key down event.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Timorg
Member #2,028
March 2002

It would be nice if it was consistant between the console and X.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Thomas Fjellstrom
Member #476
June 2000
avatar

SiegeLord, X is not Windows. Get over it :P

But that oddness of shift being ignored in the following sequence does seem like a bug:

Press c
Release c
Press d
Release d
Press space
Press shift
Release space
Press 7 (shift still pressed)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

BAF
Member #2,981
December 2002
avatar

SiegeLord has a very valid complaint.

alethiophile
Member #9,349
December 2007
avatar

I agree that the caps lock inconsistent behavior is a bug, though not one I've ever had a problem with (I remap capslock to ctrl, to use emacs). I can't imagine it's too serious for most people, though, as most people who use it at all use it as a switch.

--
Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.
C++: An octopus made by nailing extra legs onto a dog.
I am the Lightning-Struck Penguin of Doom.

Go to: