Friday, March 14th, 2008

Invoke Openbox's Menu with xdotool

Something I wanted to do with my Openbox install was to call the main Openbox menu from my instance of tablaunch. I wanted to do this as it's not always easy/possible to find and area of the desktop to right-click on, especially when operating on a small screen with maximised windows.

As luck would have it, somebody had already found a solution for this and published details about it on the Arch Linux wiki. The solution involves installing a small utility called xdotool. There's no package for xdotool in the Ubuntu repositories, so I've created one and placed it in the CrunchBang Linux repository.

For future reference; follow the steps below to install xdotool and configure Openbox so that you can summon the main menu from a command:

1. Install xdotool, either from source, via the .deb file, or via the repository with the following command:

sudo apt-get install xdotool

2. Edit Openbox's rc.xml file and add the following code to the "keyboard" section:

<keybind key="A-C-q">
  <action name="ShowMenu">
    <menu>root-menu</menu>
  </action>
</keybind>

3. Reconfigure Openbox to apply the changes, enter the following command:

openbox --reconfigure

4. Call the Openbox menu with the following command:

xdotool key ctrl+alt+q

It should now be possible to bind the menu to your favourite application launcher, such as tablaunch or wbar.


11 Responses to “Invoke Openbox's Menu with xdotool”

  1. Netfun81 wrote,

    Thanks, My tablaunch is now working with the openbox menu. I appreciate you adding these gems into the repository for us and the great instructions. Im a long-time linux user (since 1995) and am still surprised at the vast amount of software that is available. Another great launcher is called "apwal" which you can bind to a mouse button in openbox to bring up icons of your favorite programs. It uses no ram until you launch it with the mouse button.

  2. Philip wrote,

    @Netfun81: Thank you for your kind words, they're appreciated :) apwal sounds interesting, me thinks I'll have to investigate. Thanks for the tip.

  3. arpbook wrote,

    hi philip and thanks for build that xdotool.deb ….. so useful. wbar is not longer on my laptop. tablaunch is really the best launcher for #!

  4. fauno wrote,

    great! i'll try it on pypanel :p, but where the ob menu appears? under mouse pointer or above tablaunch?

    do you know at least one app launcher like… er… katapult? i've found some, but they have too much dependencies for me.

  5. Philip wrote,

    @fauno: When used with tablaunch, the menu does appear under launchtab, but this isn't too much of a problem as tablaunch hides itself away after a second or so. BTW, it works well with pypanel too :)

    Regarding applications similar to Katapult, I've not found any, but then I've not looked much. Let me know if you find anything, I'd be interested to hear about it.

  6. fauno wrote,

    @Philip, ok, I'll let you know. I've seen one for gnome, quite pretty, but with 50mb on depends including tomboy, it's name it's gnome do (http://do.davebsd.com/). Finally I took one little C app: just a black terminal-like bar where you type complete commands (no autocomplete).

    I'll write about this post on my blog ;)

    btw, I left another comment laughing at myself for asking "under mouse pointer or above tablaunch?"… stupid question, isn't it?

    salud!

  7. Philip wrote,

    @fauno: I've been looking at GNOME Do — it's been hard to miss all of the related blog posts and twittering. I really like the concept and the plugin architecture, if I was using GNOME I'd install it without hesitation. I'm looking forward to reading your blog post about it.

    Regarding the question, I didn't think it was stupid, maybe just a little skewed. The question of menu placement is valid :)

  8. fauno wrote,

    ready!

    http://send-fruit.com.ar/text/tip-abrir-el-menu-de-openbox-desde-consola/ I made mention of Crunchbag Linux too.

    really?

    I didn't see anything about gnome do (lately, at least), maybe I wasn't paying attention :p

  9. chris4585 wrote,

    I love this, I got it to work thanks to you, but only one thing, I kept having trouble with the xml code that you gave, it would show the menu for a second then move to the next workspace, odd, so I used a previous xml code

    <keybind key="Alt-Z">
      <action name="ShowMenu">
        <menu>root-menu</menu>
      </action>
    </keybind>
    

    And it worked. Thank you Phillip

  10. Philip wrote,

    @chris4585: Not sure why the XML was giving you trouble, maybe your system already had a keybinding for ctrl+alt+q or a combination of? Anyhow, I am glad to hear you managed to get it working :)

  11. Xvedejas wrote,

    Thanks for the info! I also got pypanel to launch the menu, which works great for me (I use pypanel only as a launcher/tray and for my main panel I use bmpanel).

Add Your Comment

Use the form below to add your comment. Markdown syntax is available. Note, comments are moderated by me for spam filtering. Alternatively, feel free to contact me privately.