Autohide xfce4-panel with a keybinding in Openbox
November 26, 2011
Since version 4.6, Xfce uses a settings editor, similar to Gnome’s gconf. You can edit the settings in xfconf from the command-line with its command-line utility xfconf-query. This is handy if you want to control certain aspects of Xfce through Openbox’ keybindings. On Loka, my desktop computer, I use Openbox as the window manager in Xfce, and use the xfce4-panel, which is set to be always visible. Occasionally, however, I want to hide the panel, and thanks to xfconf-query I can do that with a simple keybinding.
Here is what I use in the keyboard section of my rc.xml:
<keybind key="W-o"> <!--Autohide xfce4-panel--> <keybind key="h"> <action name="Execute"> <execute>xfconf-query -c xfce4-panel -p /panels/panel-0/autohide -s true</execute> </action> </keybind> <keybind key="S-h"> <action name="Execute"> <execute>xfconf-query -c xfce4-panel -p /panels/panel-0/autohide -s false</execute> </action> </keybind> </keybind>
This makes the Win+o+h keychain (auto)hide the xfce4-panel and Win+o+Shift+h make the panel visible again. (In my configuration, W-o starts the keychain for all Openbox and DE related keybindings)
Note that if you run more than one xfce4-panel, this keybinding will only hide the first panel (panel-0). If you want to hide a different panel, change /panels/panel-0/ to the appropriate value (/panel/panel-1/ for example). You can find out the panel number in the “Panel preferences” dialog (where “Panel 1” will be named “panel-0” in xfconf, “Panel 2” will be “panel-1”, and so on), or you can check it in xfce4-settings-editor.