You are not logged in.

#1 2008-10-08 17:11:04

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

How to find capslock status?

Hi,

how do I get capslock status and keyboard layout in a bash script? hmm

Thanks
David

Offline

#2 2008-10-08 19:19:30

Mashi
Member
Registered: 2007-02-19
Posts: 38

Re: How to find capslock status?

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

#3 2008-10-09 21:43:49

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: How to find capslock status?

Mashi wrote:

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

#4 2008-10-09 22:04:18

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: How to find capslock status?

Look at the keyboard and check if the caps lock lamp is on big_smile


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

#5 2008-10-09 22:55:02

tanis
Member
From: Poland / Waterloo, ON, Canada
Registered: 2007-04-21
Posts: 259

Re: How to find capslock status?

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

#6 2008-10-09 23:07:07

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: How to find capslock status?

tanis wrote:

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

#7 2008-10-09 23:35:02

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: How to find capslock status?

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

#8 2008-10-10 19:15:33

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: How to find capslock status?

tanis wrote:

Maybe you should check kdm's source? In the login/password dialog there is a warning if capslock is on.

+1

Dusty wrote:

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

#9 2008-10-10 19:19:51

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: How to find capslock status?

moljac024 wrote:

Look at the keyboard and check if the caps lock lamp is on big_smile

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 big_smile.

Offline

#10 2008-10-10 19:23:34

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: How to find capslock status?

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

#11 2008-10-11 00:03:57

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: How to find capslock status?

dante4d wrote:
moljac024 wrote:

Look at the keyboard and check if the caps lock lamp is on big_smile

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 big_smile.

It was a joke smile 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

#12 2008-10-11 17:45:26

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: How to find capslock status?

skottish wrote:

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

#13 2008-10-11 17:47:51

dante4d
Member
From: Czech Republic
Registered: 2007-04-14
Posts: 176

Re: How to find capslock status?

moljac024 wrote:
dante4d wrote:
moljac024 wrote:

Look at the keyboard and check if the caps lock lamp is on big_smile

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 big_smile.

It was a joke smile Sorry if it offended you.

No problem, the guy with the vacuum cleaner joke smile

Offline

#14 2008-10-11 22:19:40

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,329

Re: How to find capslock status?

For keyboard layout: look for skb on this page http://www.rootshell.be/~polachok/code/

Offline

#15 2015-03-13 20:39:38

NoSuck
Member
Registered: 2015-03-04
Posts: 157
Website

Re: How to find capslock status?

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

#16 2015-03-13 20:50:47

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: How to find capslock status?

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 wink

Last edited by Inxsible (2015-03-13 20:53:14)


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB