CAPS lock status in Linux

Hi,
I'm trying to get the CAPS lock status in Java to display the same to the user in my application. I've used the code
Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK) .
This works properly in Windows but throws UnsupportedOperationException in Linux. Can you help me to get the CAPS lock state in Linux.
Regards
Ruban

Moderator action: Moved from Generics
db

Similar Messages

  • How can i bind something to caps lock in AwesomeWM?

    Recently i've aquired new notebook which doesn't have caps_lock, num_lock and scroll_lock LEDs, so i decided to put keyboard layout indicator to system tray.
    Currently i am using Xorg config to set XkbLayout and XkbOptions (like so http://paste.pocoo.org/show/478789/ ).
    I tried first widget from http://awesome.naquadah.org/wiki/Change_keyboard_maps but soon realized that it does not detect layout change in any way, so i would like to bind kbdcfg.switch function to caps_lock, but i can't find any documentation on binding something to caps_lock.
    Also i've noticed a strange thing, when i change my layout with this function i am unable to use shortcuts that use latin letters. They are obviously remapped to by сyrillic, but they do work if i change my layout with caps_toggle. Why do the work with caps_toggle, and how can i make them work with kbdcfg.switch?

    blin wrote:
    filam wrote:Is there a reason you're not using xmodmap? You may also want to read the Extra Keyboard Keys in Xorg article.
    The only reason i have for not using xmodmap is, i don't understand how it can help me, with the task i have. The other article didn't help me either.
    Did you read the "How to find capslock status?" thread?
    blin wrote:Is suspect the answer is not what you want because your question is not very clear. I understand that you have a keyboard that is lacking certain keys. What is it that you want to achieve? Let some key act as capslock?
    I had to read the OP twice to understand it. I didn't notice that he wrote "LED" in the first sentence. What he wants is for his Awesome status bar to display the current activity (i.e. on/off) of the Caps Lock, Num Lock and Scroll Lock keys. He does not need to remap any keys.
    Edit: Check Retrieving CAPS LOCK info using Xlib or just do a Google search for "linux caps lock status -map -disable".
    Last edited by filam (2011-09-20 19:43:45)

  • Caps Lock LED incorrect when changing modifier keys

    Hello,
    I remapped Caps Lock and Ctrl keys via keyboard settings (they're now flipped). Unfortunately the Caps Lock LED is still being activated by the "old" Caps Lock key (which is now the Ctrl key). This means that whenever I hit Ctrl (using the Caps Lock key) the Caps Lock LED changes its status.
    This is rather annoying as it ends up being in random state and tells me nothing about the actual Caps Lock status. Is there a way to fix this?
    Thanks!

    Hello:
    I suggest you call Applecare with a warranty issue.  The KB has a one year Apple warranty.  I would not waste any more time trying additional things.  You have already tried everything I would suggest.
    Barry

  • How to get the "Caps Lock" key's original status in Redhat linux FC4?

    I have realized it in Windows XP platform by
    Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK),
    and it works very well in Windows XP platform,
    but it doesn't work in Redhat Linux FC4,
    and throws UnsupportedOperationException.
    Anybody can tell me whether there is any other methods
    to get the "Caps Lock"  key's original status in Redhat Linux FC4
    by jdk1.5.0_02 or later.
    Any help will be greatly appreciated here in advance,
    and thanks a million for your attention.

    Crosspost: http://forum.java.sun.com/thread.jspa?threadID=687159

  • Updating caps lock and num lock status

    I need to keep track of the status of the caps lock and num lock keys in a status bar of my frame.
    I get the current status with a code like this
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    numLockState = toolkit.getLockingKeyState(KeyEvent.VK_NUM_LOCK);
    capsLockState = toolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
    fireChangeEvent();
    where fireChangeEvent() updates a label in the status bar. The code is invoked when any of the caps lock and num lock keys are pressed (while the window has the focus) and when the window is activated. This code works while the window has the focus (i.e. the status of the keys if correctly tracked). It does not work correctly when the window is activated.
    Specifically the following scenario fails:
    - The window has focus and the state of the keys if correctly reported by the code above (say caps lock up, num lock
    up);
    - The window loses focus, i.e., another (non java) window gains the focus;
    - The user presses any of the two keys (say the caps lock key);
    - The window regains focus.
    When the latter event happens the code above is invoked (as a consequence of the window being activated) but it continues to report the status of the keys at the time the focus was lost by the window (caps lock up, num lock up).
    It seems that the toolkit does not automatically updates its internal status if a key is pressed when the java window does not have the focus. If I press the caps lock key (so that it returns to the up state) after the window has regained focus the status is updated and the new state is correctly reported. I need to manually realign the status by pressing the keys to have them correctly reported by the toolkit.
    Some ideas on how to have correct key status even after the window looses the focus?
    Thanks.

    Specifically the following scenario fails:
    - The window has focus and the state of the keys if correctly reported by the code above (say caps lock up, num lock
    up);
    - The window loses focus, i.e., another (non java) window gains the focus;
    - The user presses any of the two keys (say the caps lock key);
    - The window regains focus.
    When the latter event happens the code above is invoked (as a consequence of the window being activated) but it continues to report the status of the keys at the time the focus was lost by the window (caps lock up, num lock up).sorry! i tried this in a JFrame windowActivated() and i got the desired result it breaks your senario.
    the only is though it is not sensing the keyStrokes but if window looses focus because of another window gains focus it changes the values when it get focus next by ne means.
    Provide a short executable code might be the problem lies there.

  • CAPS Lock, NUM Lock Statuses

    hi,
    i am using forms6i, I want to know the status of CAPS Lock, and NUM Lock. How can i get those status.

    Hi,
    You need to read registry to check Capslock and Num lock. I did this earlier but cannot remember it. Let me check it out.
    If you are into web development then use Java Beans.
    Regards,
    Asif Momen.

  • Xmonad, ledmon do not show status in xmobar, maped caps lock

    Hi,
    I am in the progress of configurating xmobar togheter with Xmonad and so far it is going really good thanks to the help I got from you guys.
    But now I am stuck.
    I have added Keyboard LED Indication, following John Goerzen's excelent guide.
    Installed "ledmon" from AUR and added in xmonad.hs
    , Run CommandReader "/usr/bin/ledmon" "LED"
    , template = "%StdinReader% }{ <fc=#ffff00>%LED%</fc> %cpu% | %memory% * %swap% <fc=#ee9a00>%date%</fc> | %EGPF%"
    Keyboard LED indication works great.
    The problem is that I from time to time want to enter Swedish caracters and for the reason switch to se keymap.
    I did that according to Archlinux wiki about X.
    in /etc/X11/xorg.conf i added.
    Option "XkbLayout" "us, se"
    Option "XkbOptions" "grp:caps_toggle"
    I can now easily toggle keyboard layout using caps lock.
    However I do not get a indication in xmobar that caps lock is on. That would be great to se.
    Any idea on how to accomplies this?
    Thank you.
    Best regards,
    /Christer
    Last edited by agkbill (2011-08-06 07:01:20)

    Downgrade to xmobar-0.15. See here.

  • How do i turn off caps lock/numbe​r lock notificati​on.

    I purchased a computer today and the only thing wrong is the caps lock /number lock notification that pops up in the right hand bottom of the screen. Whenever I press CTRL ATL Delete, the app that is runnning is called, HPKEYBOARD status. I tried to end it, it stopped temporarily. But when i restart the computer the problem is back, please help.

    Hello @Flashster,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I have read your post on how you are looking to disable the caps lock/number lock notification on your desktop's display screen, and I would be happy to assist you in this matter!
    In order to remove HPKEYBOARD status from your startup programs, you will need to disable by following this document on Using Microsoft System Configuration (Windows 7). The Quick Launch application responsible for HPKEYBOARD should be among the services to disable.
    Please re-post with the results of your troubleshooting, and I look forward to your reply!
    Regards
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • ****PLEASE HELP ME SOMEONE**** PLEASE - Re: ON SCREEN CAPS LOCK INDICATOR

    can someone please help me before i pull all of my hair out.
    i have windows vista - 64 bit - the HP IQ500 touchsmart with a wireless keyboard.
    in the systray the num caps and scroll lock appears as little blue boxes (when on).
    everynow and again they simply disapper.
    i researced how to activate them again but cant remember how to do it.
    there is a way without having to mess with the registry and without downloading any program
    i just cant remember how. i know wherever it is...you ultimately get 3 boxes that you can check in order to turn the options back on.
    i am not talking about toggling, or sound, or mscofig and then boot.
    does anyone know the steps to turn the caps scroll and num lock indicator in teh sys tray back on
    oh, and right clicking on the toolbar and going to the notificiation area is not what i am referring to either.
    I checked in the control panel programs and the hp on screen caps lock indicator etc program is there.
    I reinstalled it nonetheless and confirmed it is installed properly
    When I right click on the notification area I do to properties/notification area/customize
    There are two lists there
    1. Current Items and
    2. Past Items
    For some reason I see caps lock - scroll lock and num lock under the past items
    There you are also able to change the status of the items to either Hide wne active, hide or show
    All three (caps/num/scroll) are SHOW
    I click apply OK then apply
    I restart the computer and nothing. The on screen caps lock indicator is still not in the notification area/systray area
    I repeat teh steps to ensure that the three have the SHOW option chosen and they are.
    So....
    Program is installed
    Items are check for SHOW
    Restart was done
    Ohhh and also...I went to MSCONFIG and made sure that the HP Keyboard Program was selected/check mark as one of the start up programs.
    There in a run command to activiate the 3rd party program (hp onscreen indicator program)
    When you enter the run command that I cant remember...you then get this option where there are three check boxes...one next to num lock - one next to caps lock and one for scroll lock.
    Once you check/select the boxes/options you want...presto they appear in the sys tray/notification area.
    I just cant remember the run command it to save my life.
    Please....put my mind to ease...cause I am losing it!
    I just cant seem to "walk away"...must be my OCD :-(
    Thanks

    NO.
    We are all iPhone users just like you.
    Apple has no blacklist.
    You can contact your carrier and see if they offer such a service.
    You cannot block it at all.
    Sorry

  • Hp cap lock flashing black screen

    I have hp envy dv6 7229wm windows 8.     Cap lock blinking and wirless on/off orange light solid. things that i already did -Hard Reset unplug a/c and remove battery hold the power button for 30 sec-Hard Reset with removing cmos battery-replaced rams with places and tried new ram-cleaned fan out-applied thermo cream to cpu-and ofourse checked that my warraty status: EXPIRED i am a technician with 5 years experience in hardware and software repair. I never had this problem before.i had 4 customers called me last week about this problem and i told them it was above my head. 

    Hello cantfigureout, Thank you for providing your information, and welcome to the HP Forums! I hope you enjoy your experience! I have read your post on how your notebook computer's keyboard is displaying a blinking cap lock key and wireless light, and I would be happy to assist you in this matter! The blinking light on your Cap lock is indicating a specific hardware issue, which can be found out by following this document on Computer Does Not Start and the LEDs Blink or the Computer Beeps. Please re-post with the number of blinking lights the Cap Lock key produces, and I look forward to your reply! Best Regards

  • Disabling Caps Lock?

    I'm new to the mac world and have a brand new macbook. Coming from a linux/X-Windows background I am used to being able to remap my keyboard's functionality, or more importantly, disable particularly undesireable parts of it and I am not yet familiar enough with the MacBook to do that.
    I'm trying to figure out how to disable the Caps Lock key. I rarely need to type things in upper case and when I do, I can press the shift key.
    Any insights you could give me on how to accomplish that would be appreciated.
    Thanks
    John

    Found it. System Prefs->Keyboard and Mouse->Keyboard->Modifiers

  • Caps Lock Event Listener

    Hello to all,
    I was spending some time with event listeners today and I thought of listening for the status of the caps lock.
    Didnt find a way to check it so maybe the listener is the best way to do it.
    Any thoughts on how this can be achieved? It would be very helpfull for login purposes to see if the user is typing with caps lock on.

    For a key Up/DOWN event, the CapsLock KeyCode is 20. But you should use the Keyboard.CAPS_LOCK constant instead.
    In a Keyboard event handler:
                 if (event.keyCode == Keyboard.CAPS_LOCK){
                     // true if capslock was pressed
    To check if the key is toggled on or off, do this:
                 if (Keyboard.capsLock){
                  //true if caps lock is on; false if not.
    Add a listener like this:
            public function addHandler():void{
                //Called from app's creation complete event.
                //Listener to handle any keyboard KEY_DOWN event:
                this.addEventListener(KeyboardEvent.KEY_DOWN,handleKeyDown);

  • OSX Caps Lock stuck on (not a sticky keyboard)

    You see this question posted frequently, and I have searched exhaustively to find the right solution for my problem, to no avail.
    Occasionally, my iMac will get into a funky mode where EVERTHING I TYPE IS IN CAPITAL LETTERS, regardless of the status of Caps Lock. Yes, I know, it's annoying. But it's more than just annoying because it makes it impossible to unlock the screen and I have to reboot, losing unsaved work in the process. ARGH!
    You're probably already thinking of all the silly solutions; removing cracker crumbs or grape jelly from under the keys, unplugging/replugging the USB keybard or trying a different keyboard. Let me save us both some time, because it's not that obvious. I ask you to put your thinking cap on, because right now my screen is locked and I would rather not have to reboot. My wife has some unsaved work that I don't want to lose! Do you accept the challenge? Thanks! Here's what we know, and some of the things we can rule out:
    * This has been known to happen while I am typing.
    * The only solution I have found to restore normal behavior is a simple reboot, which resolves the problem every time.
    * It is not a bad keyboard. The same behavior is exhibited by known good USB and Bluetooth OEM keyboards, as well as a third aftermarket keyboard.
    * The Caps Lock keys on ALL THREE keyboards are working properly, as demonstrated by the Caps Lock LED toggling on/off with each press of the key.
    * However, the Caps Lock indicator in the Password field STAYS ON and does NOT toggle when the key is pressed!
    * No key behavior has been changed from their default Preferences.
    * This was happening with the factory install of Lion, and has continued after the in-house upgrade to Mt Lion.
    * This occurs only once every two months or so, which is why I have never got around to opening a ticket with Apple.
    All of this leads me to believe that there is nothing wrong with my computer. I believe that, quite by accident, I fat-finger some magical key combination that triggers this behavior. Unfortunately, I can never figure out what I've done, or how to get it back to normal without rebooting the darn thing. Until I can figure out what triggers this behavior (and so presumably will be able to toggle back to normal when it occurs), I think my best workaround is to use a password that has all upper case letters so at least I can unlock it when it does happen. Unfortunately, right now I am still facing losing work due to a reboot if I can't find a real solution.
    Suggestions? Advice? SOLUTIONS????

    Hi Donna, if you've already rebooted, try this workaround...
    System Preferences>Keyboard>Modifier keys>Caps Lock=no action.

  • Sense The Cap Lock

    Is there anyway in TestStand 3.0 to detect the position of the Cap-Lock key?  Depending upon its state, it will either be OK or cause my barcode reader to give me fits.  Your thoughts?
    Tony

    Hello Tony,
    You can use the Win32 function GetKeyState to figure out if the caps-lock is toggled or not. 
    You can find more information on this function on MSDN:
    http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx
    You can pass 20 into this function to get the status of the caps-lock key.
    I made an example in TestStand to show you how to call this function and then displays the result. 
    Please let me know if you have any questions.
    Kristen
    National Instruments
    Attachments:
    capsLock30.seq ‏26 KB

  • [ZSH] Right click key turning text into caps lock

    Hi,
    In zsh, my right click key turns text in caps lock and I have to type Ctrl+C to get back to the command prompt.
    Is there a way to change this behaviour ?
    Thanks

    You can check the caps lock only if the swf has focus. When embedded in an HTML doc, the swf  does not receive focus by default.
    Create a new FLA and add a TextField labeled "status".
    Add this script to the first frame.
    var state:String="INACTIVE"
    addEventListener(Event.ACTIVATE, ah);
    addEventListener(Event.DEACTIVATE, dh);
    addEventListener(Event.ENTER_FRAME, efh);
    function checkCapsLock():void {
    status.text= state + "  " + "Keyboard: Caps Lock " +
      (Keyboard.capsLock ? "ON" : "OFF") + "!";
    function efh(event:Event)
    checkCapsLock();
    function ah(event:Event)
    state="ACTIVE";
    checkCapsLock();
    function dh(event:Event)
    state="INACTIVE";
    checkCapsLock();
    Run this in a browser and click inside and outside the swf area, while toggling the Caps Lock.

Maybe you are looking for

  • Error in using Control in PageFlow Portal deployment on Weblogic9.2

    I am developing a small portal application in Weblogic9.2 using workshop. It uses pageFlow portlets to access a Control that connects to a database. When i add the @Control annotation tag to my pagecontroller and deploy the application it gives the b

  • Unknown computers showing up under "Shared" on secured wireless network.

    After reading through the forums, it looks like I am not the only person who has encountered this, but I haven't found any real answers and my situation is a bit different. Yesterday, unknown computers started showing up in the "Shared" sidebar in Fi

  • Flash CS4 and XML

    Hi, I'm using Flash CS4,i'm having problems creating a xml file to work with the action script for a 3D carousel. I've created folder for the image png file and icons xml using a normal notepad in windows for file to work with the flash action script

  • How to display smart form stored in SAP in Webdynpro java( TLINE table)

    Hi I have a requirement where I have to display the smart form from WD Java end. The BAPI is producing output in TLINE(TDLINE(132),TDFORMAT(2)). I am trying to concat both(TDLINE+TDFORMAT) and put in the interactive form but I am not able to get the

  • Java.sql.PreparedStament

    when i use the java.sql.statement i cant create it with scrollable property. like this: // Create a Statement object that will be used to excecute the query. // The arguments specify that the returned ResultSet will be // scrollable, read-only, and i