You are not logged in.

#1 2010-07-16 10:45:58

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Openbox: keycodes and keybindings

I've got a six year old very basic Logitech wireless keyboard with 8 hotkeys (inc volume). I've found the keycodes using showkey, but I can't get them to do anything. I'm trying to get keycode 172 (hexadecimal AC) to start Firefox, and keycode 156 (hex 9C) to start xterm, with the following code in my home/USERNAME/.config/openbox/rc.xml:

  <!-- Keybindings for running applications -->
  <keybind key="0xAC">
    <action name="Execute">
      <startupnotify>
        <enabled>true</enabled>
        <name>firefox</name>
        <wmclass>Firefox</wmclass>
      </startupnotify>
     <command>firefox</command>
    </action>
  </keybind>
  <keybind key="0x9C">
    <action name="Execute"><command>xterm</command></action>
  </keybind>
  <keybind key="W-e">
    <action name="Execute">
      <startupnotify>
        <enabled>true</enabled>
        <name>Konqueror</name>
      </startupnotify>
      <command>kfmclient openProfile filemanagement</command>
    </action>
  </keybind>

  <!-- Other keybindings -->
  <keybind key="C-Escape">
   <action name="Exit">
   </action>
  </keybind>

My Other keybinding C-Escape to exit openbox works fine, but why not the hotkeys?

Last edited by dameunmate (2010-07-16 14:06:26)

Offline

#2 2010-07-16 10:50:26

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Openbox: keycodes and keybindings

You're missing the xmodmap piece of the process - see here for details.

Offline

#3 2010-07-16 12:15:06

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: Openbox: keycodes and keybindings

I just tried that but it didn't work. Uninstalled and deleted xbindkeys.

But a small change to home/USERNAME/.config/openbox/rc.xml does work, the following code starts firefox when I press the key with keycode 172:

  <keybind key="XF86HomePage">
   <action name="Execute">
    <execute>firefox</execute>
   </action>
  </keybind>

Why is is that <keybind key="XF86HomePage"> does work but <keybind key="0xAC"> does not work? 0xAC = 172 in decimal = the correct keycode for the XF86HomePage button, so why doesn't that work? It should work in Openbox, see http://openbox.org/wiki/Help:Bindings#Key_combination: "Keys can also be specified by their numeric codes. This can be done by specifying the keycode in hex." I have another keyboard with loads of extra keys so I need to be able to use keycodes in rc.xml

Last edited by dameunmate (2010-07-16 14:05:01)

Offline

#4 2010-07-16 15:42:19

xamaco
Member
From: Corsica, France
Registered: 2010-04-05
Posts: 87

Re: Openbox: keycodes and keybindings

I don't have the answer, but if you want there is a small utility to configure keys in openbox : obkey
http://code.google.com/p/obkey/

Offline

#5 2010-07-16 17:27:55

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: Openbox: keycodes and keybindings

dameunmate, I suggest you to use 'xev' to get the name of the key you're interested in and then insert it into your rc.xml.
Using xev-assigned names always worked for me.
Cheers,


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#6 2010-07-16 18:04:18

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: Openbox: keycodes and keybindings

On my keyboard, the XF86HomePage button has the keycode 180 which converted to hex is 0xB4. I have no problems using the hex codes in my Openbox setup. Did you remember to run "openbox --reconfigure" afterwards?

Otherwise I would follow rent0n's suggestion of using xev to double-check you got the right keycode.

Offline

#7 2010-07-16 18:36:51

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: Openbox: keycodes and keybindings

anonymous_user wrote:

On my keyboard, the XF86HomePage button has the keycode 180 which converted to hex is 0xB4. I have no problems using the hex codes in my Openbox setup. Did you remember to run "openbox --reconfigure" afterwards?

Otherwise I would follow rent0n's suggestion of using xev to double-check you got the right keycode.

No, I wasn't clear enough. Actually I meant to use the name of the key according to xev (like 'XF86HomePage') rather than the keycode. wink


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#8 2010-07-17 20:33:06

dameunmate
Member
From: London
Registered: 2010-01-19
Posts: 85
Website

Re: Openbox: keycodes and keybindings

yes all the xev-assigned names do work fine for me, but the keycodes still don't work regardless whether I reconfigure or reboot. According to http://openbox.org/wiki/Help:Bindings#Key_combination keycodes should be assignable out of the box (out of the Openbox! tongue). Even the wiki article recommended by tomk above suggests the same thing: http://wiki.archlinux.org/index.php/Ext … rg#Openbox

Offline

Board footer

Powered by FluxBB