Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My keyboard has a Sleep button. I defined a shortcut in System Settings, Keyboard > Shortcuts > own settings (or similar), so that the Sleep buttons runs a script. That works.

But since my upgrade to Oneiric, something also locks the screen (in the same way the screen is locked when I press Ctrl+Alt+L). Can I disable that behaviour? What's the name of that lock screen?

I tried hiding gnome-screensaver and /etc/acpi/ and I looked in gconf-editor /apps/gnome-power-manager/buttons. I didn't find anything related in dconf-editor.

share|improve this question
1  
You can accept your own answer. –  hexafraction Jun 15 '12 at 23:01

1 Answer 1

up vote 1 down vote accepted

You can remap the key using ~/.Xmodmap. Use xev (in a terminal) to find the offending keycode, then assign a different keysym, e.g. XF86WakeUp. Append this line to ~/.Xmodmap (create that file if it does not yet exist):

keycode 150 = XF86WakeUp

After logging out and logging in again your key should be mapped. If you don't want to log out, you can also use xmodmap ~/.Xmodmap to reload the key mappings.

Using xev to actually find the keycode of the key that you want to remap might be not so easy: if the key is already bound to an action (e.g. in the Gnome keyboard properties), xev does not show the keycode. As an example, this is the kind of xev output that you want to see:

KeyPress event, serial 41, synthetic NO, window 0x5800001,
    root 0xb3, subw 0x0, time 312883, (737,182), root:(946,647),
    state 0x0, keycode 180 (keysym 0x1008ff18, XF86HomePage), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

You can see the keycode (180) in the third line after the word "keycode". If you don't get such a block that starts with "KeyPress event", your key probably is already bound. You can try to use a non-Gnome desktop like LXDE or KDE and use xev there.

share|improve this answer
    
Can you explain this further. (Trying to learn) –  Anwar Shah Jun 16 '12 at 0:53
    
I edited the answer. Is that what you were looking for? –  elmicha Jun 16 '12 at 8:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.