Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: [SOLVED] disable key on keyboard

  1. #1
    Join Date
    Jun 2008
    Location
    Round Rock, TX
    Beans
    67
    Distro
    Ubuntu 8.10 Intrepid Ibex

    [SOLVED] disable key on keyboard

    My keyboard has an incredibly dumbly placed "sleep mode" key that I occasionally accidentally hit.

    Is there any way that I could disable that one key?
    Quad Core Q6600 3GB RAM 300GB Hard DriveS nVidia GeForce 8400
    Current Ubuntu Problems (2) PLEASE HELP!!:[NOT solved]Disappearing Firefox windows | [NOT SOLVED]AR5413 Atheros Card, NO linux support?
    Current Vista Problems (1): It fails to boot

  2. #2
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: disable key on keyboard

    Is it a desktop machine? If so and, you never use the "sleep" mode, you could probably disable it by hitting Alt-F2 and typing gconf-editor. Then navigate to /apps/gnome-power-manager/general and uncheck can_suspend and can_hibernate.
    Don't try to make something "fast" until you are able to quantify "slow".

  3. #3
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: disable key on keyboard

    This works for symbols. Since it is merely sending a signal, I would expect it to work for this situation as well.

    Run the following command to find the keycode value of the desired key:
    Code:
    xev
    With the small box in foreground, press the sleep key and note the keycode value.
    Then run this:
    Code:
     xmodmap -e 'keycode number = NoSymbol'
    That should disable the key. To make it permanent, put this command in the System, Preferences, Sessions, Startup Programs folder, Add.

    Edit: Typo corrected. Thanks Sepero.
    Last edited by drs305; June 17th, 2010 at 01:55 AM.

  4. #4
    Join Date
    Jun 2008
    Location
    Round Rock, TX
    Beans
    67
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: disable key on keyboard

    Quote Originally Posted by vor View Post
    Is it a desktop machine? If so and, you never use the "sleep" mode, you could probably disable it by hitting Alt-F2 and typing gconf-editor. Then navigate to /apps/gnome-power-manager/general and uncheck can_suspend and can_hibernate.
    Thanks! Worked very nicely. When I press the key, however, it comes up with a hundred popups saying "action disallowed", lagging my system to death for about a minute. Is there any way I can disable that too?

    EDIT: problem solved; I changed the value of suspend in Gnome-Power-Manager > Buttons to "nothing"


    Quote Originally Posted by drs305 View Post
    This works for symbols. Since it is merely sending a signal, I would expect it to work for this situation as well.

    Run the following command to find the keycode value of the desired key:
    Code:
    xev
    With the small box in foreground, press the sleep key and note the keycode value.
    Then run this:
    Code:
     xmodmap -e 'keycodenumber = NoSymbol'
    That should disable the key. To make it permanent, put this command in the System, Preferences, Sessions, Startup Programs folder, Add.
    Thank you; this is a very useful tool. I have to go with vor's way though, because my computer can't recover from sleep mode, and therefore I can't note the keycodenumber >.<; And that way also prevents me from making it go into sleep/hibernate from the shutdown window.
    Last edited by Deutscher Alex; June 28th, 2008 at 03:00 AM.
    Quad Core Q6600 3GB RAM 300GB Hard DriveS nVidia GeForce 8400
    Current Ubuntu Problems (2) PLEASE HELP!!:[NOT solved]Disappearing Firefox windows | [NOT SOLVED]AR5413 Atheros Card, NO linux support?
    Current Vista Problems (1): It fails to boot

  5. #5
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: disable key on keyboard

    Quote Originally Posted by Deutscher Alex View Post
    Thanks! Worked very nicely. When I press the key, however, it comes up with a hundred popups saying "action disallowed", lagging my system to death for about a minute. Is there any way I can disable that too?

    EDIT: problem solved; I changed the value of suspend in Gnome-Power-Manager > Buttons to "nothing"
    Glad it worked. It probably would have been sufficient to make that change in the first place but, I'd forgotten that option was there.
    Don't try to make something "fast" until you are able to quantify "slow".

  6. #6
    Join Date
    Jun 2008
    Location
    Round Rock, TX
    Beans
    67
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: disable key on keyboard

    Quote Originally Posted by vor View Post
    Glad it worked. It probably would have been sufficient to make that change in the first place but, I'd forgotten that option was there.
    Hmm yea, but now I don't have those extraneous suspend/hibernate options on the shutdown screen =)
    Quad Core Q6600 3GB RAM 300GB Hard DriveS nVidia GeForce 8400
    Current Ubuntu Problems (2) PLEASE HELP!!:[NOT solved]Disappearing Firefox windows | [NOT SOLVED]AR5413 Atheros Card, NO linux support?
    Current Vista Problems (1): It fails to boot

  7. #7
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: [SOLVED] disable key on keyboard

    vor's method would certainly be the way to go in that it directly addresses the power mode instead of indirectly altering a key.

    for future reference or other readers, there is an alternate method of discovering the keycode in cases such as this one where you might not want to actually press the key (d'oh!). you can run this and then find the keycode. for normal keys you could limit the output by adding " | grep symbol " but in this case the sleep key isn't called sleep, at least on my computer.
    Code:
    xmodmap -pke
    glad you were able to solve your problem

  8. #8
    Join Date
    Nov 2007
    Beans
    11

    Re: [SOLVED] disable key on keyboard

    Cheers drs305. I used this successfully to disable the MS Windows Menu key:

    xmodmap -e "keysym Menu = NoSymbol"

    Steve.

  9. #9
    Join Date
    Nov 2004
    Beans
    226
    Distro
    Ubuntu

    Re: disable key on keyboard

    Quote Originally Posted by drs305 View Post
    This works for symbols. Since it is merely sending a signal, I would expect it to work for this situation as well.

    Run the following command to find the keycode value of the desired key:
    Code:
    xev
    With the small box in foreground, press the sleep key and note the keycode value.
    Then run this:
    Code:
     xmodmap -e 'keycodenumber = NoSymbol'
    That should disable the key. To make it permanent, put this command in the System, Preferences, Sessions, Startup Programs folder, Add.

    The command should be:
    xmodmap -e 'keycode number = NoSymbol'

  10. #10
    Join Date
    Jan 2010
    Beans
    29
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: [SOLVED] disable key on keyboard

    Sory to reply on a Solved thread but i have a question ,does it work only on X.Session because i wan't to disable a key at GRUB Boot Loader menu ?

    Is that possible to block it through this tool ?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •