You are not logged in.
Pages: 1
Topic closed
Hi,
how do I get capslock status and keyboard layout in a bash script?
Thanks
David
Offline
Keyboard layout I don't know.
Caps lock status I think it depends on if you are using it in Gnome, KDE or without X... but there are some programs that to it.
http://www.truesoft.ch/dieter/kkeyled.html
search for keyled also.
I don't know which one will work for you..
Offline
Keyboard layout I don't know.
Caps lock status I think it depends on if you are using it in Gnome, KDE or without X... but there are some programs that to it.
http://www.truesoft.ch/dieter/kkeyled.html
search for keyled also.
I don't know which one will work for you..
That at least gives me a clue, thanks. I'm amazed that there are so few references about this topic... There probably is some X tool fot this, but I'm not very lucky with google this time...
Offline
Look at the keyboard and check if the caps lock lamp is on
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Maybe you should check kdm's source? In the login/password dialog there is a warning if capslock is on.
Last edited by tanis (2008-10-09 22:55:22)
Offline
Maybe you should check kdm's source? In the login/password dialog there is a warning if capslock is on.
Oh yeah, that's a good idea, Also, gnome-screensaver (when unlocking the screen) shows a warning if caps lock is on.
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
xset q | grep LED
should give you a bitmask of what the led status is in the last column. Run it through cut and manipulate it for fun times.
Dusty
Offline
Maybe you should check kdm's source? In the login/password dialog there is a warning if capslock is on.
+1
xset q | grep LED
should give you a bitmask of what the led status is in the last column. Run it through cut and manipulate it for fun times.
+1
Thanks
Offline
Look at the keyboard and check if the caps lock lamp is on
And how does that tell my script that caps is on? I need to find the caps status when I press caps key and pipe the result somewhere. But I can see the good intention .
Offline
There are conditions under which the LEDs are wrong. For instance, I use numlockx at login to switch it on. Sometimes the LED is on, sometimes it's not. Right now it's off, but Num_Lock is still working.
--EDIT--
By the way, I can't believe how difficult it is to find this information. There are 657,765,234,434,234 hits on the first page alone of all search engines on how to disable Caps_Lock. Surely someone knows the magical shell command to find its current state?
Last edited by skottish (2008-10-10 22:59:24)
Offline
moljac024 wrote:Look at the keyboard and check if the caps lock lamp is on
And how does that tell my script that caps is on? I need to find the caps status when I press caps key and pipe the result somewhere. But I can see the good intention
.
It was a joke Sorry if it offended you.
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
There are conditions under which the LEDs are wrong. For instance, I use numlockx at login to switch it on. Sometimes the LED is on, sometimes it's not. Right now it's off, but Num_Lock is still working.
--EDIT--
By the way, I can't believe how difficult it is to find this information. There are 657,765,234,434,234 hits on the first page alone of all search engines on how to disable Caps_Lock. Surely someone knows the magical shell command to find its current state?
Well, that's it. I found zillions of pages on how to disable caps, bind it as a control, bind it as a escape... Whatever. But noone probably really cares about it's status.
I was also worried about the LED status, because that might be wrong.
Last edited by dante4d (2008-10-11 17:47:14)
Offline
dante4d wrote:moljac024 wrote:Look at the keyboard and check if the caps lock lamp is on
And how does that tell my script that caps is on? I need to find the caps status when I press caps key and pipe the result somewhere. But I can see the good intention
.
It was a joke
Sorry if it offended you.
No problem, the guy with the vacuum cleaner joke
Offline
For keyboard layout: look for skb on this page http://www.rootshell.be/~polachok/code/
Offline
I hereby invoke the powers of xkcd #979 and the Arch Wiki. The solution to this problem is simple.
# Queries:
xset -q | grep "Caps Lock: *on" 1>/dev/null
# Toggles:
xdotool key Caps_Lock
Offline
NoSuck,
After 7 years, I am sure the OP either found out how to do it or no longer gives a shit.
Please don't necrobump threads.
Closing...
EDIT : Just noticed, its your first post. Welcome to the forums
Last edited by Inxsible (2015-03-13 20:53:14)
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Pages: 1
Topic closed