Ubuntu – How to get the “name” of the key combination (keybind key) for the Openbox config file

lubuntuopenbox

It is one more attempt to get Fn keys to volume up/down, brightness, etc. working. Those controls are simply not working in my non-branded ultrabook.

In the configuration file:

/home/yourname/.config/openbox/lubuntu-rc.xml

We can find the following code:

<!-- Keybinding for Volume management -->
<keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
        <command>amixer -q sset Master 3%+ unmute</command>
    </action>
</keybind>

So I guess if we find the correct keybind key, it will work. Am I right? If so, how?

Note: I'm using the default keyboard, pc105

Note 2: in this answer, for the XF86 keyboard, the format of the keys seems something like 0x1008FF12 (code for mute in that keyboard). According with that answer, the keybind key is a shortcut to a file where that code is.

Note 3: in this forum, there is an attempt to do it with xbindkeys. Unfortunately, xbindkeys doesn't seem to capture the Fn key for me.

Note 4: after modifing the configuration file, we have to run openbox --reconfigure

Best Answer

I am not on a notebook right now and can't test if this works for Fn-combinations but I generally use xev for getting the appropriate keycodes:

xev | sed -ne '/^KeyPress/,/^$/p'

This should launch a window:

enter image description here

Keys pressed while the window is in focus will be printed to the command output. E.g. for left Win/Super:

KeyPress event, serial 42, synthetic NO, window 0x5000001,
    root 0x2d1, subw 0x0, time 42368858, (158,73), root:(934,383),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

If you wanted to assign this key to an openbox shortcut you would use Super_L (third line, second item in brackets).

xev is part of the x11-utils package and should be preinstalled on Ubuntu.