[openbox] Key to bring up the menu?

Tim Riley tr at slackzone.org
Fri Aug 1 01:22:15 EDT 2003


On Fri, 2003-08-01 at 13:53, Chris Anderson wrote:
> Perhaps I missed it in the rc3 file, is there a key combination I can
> press to show the Openbox menu while I'm not on the desktop?

How about we step out side the square on this one, Chris?  Ok, are you
ready to follow?  Let's do it!

So, here's what we're after:
(1) A key combination.
(2) The menu
(3) The appearance of (1) & (2) in the rc3 file.

A clear, enumerated definition of our goal is much like the strong,
seductively grey concrete that forms the foundation of any strong
edifice.  As Sun Tsu says, with the concrete as my light, I will find
that which is right.

As you would probably know, the rc3 that is distributed & installed with
openbox contains pretty much the definitive list of the options
available to brave man seeking to write his own configuration file. 
We're after a menu, right?  Let's see what's in the default rc3 file
that mentions the word 'menu.'

We'll be using the 'grep' tool, which "print[s] lines matching a
pattern," [1] in the following manner:

grep -i menu /usr/local/share/openbox/rc3

This returns many mentions of the m-word, but one which would
particularly interest us is this:

rc3:      <action name="showmenu"><menu>root</menu></action>

Obviously that is an action which will show the root menu!  We can
ascertain this from the fact that the the word 'root' is enclosed in
<menu> tags, which are, in turn, enclosed in <action> tags.

Now, we want to be able to launch this action from a keybinding, am I
right, Chris?  Let's use the handy dandy grep tool again, this time
looking for the word 'key.'

grep -i key /usr/local/share/openbox/rc3

Woah!  So many matches!  But you'll find that the word "key" most
commonly appears in <keybind> tags, which all enclosed inside one big
honking set of <keyboard> tags.  Upon further inspection, we will see
that inside these <keybind> tags are <action> tags, much like the menu
launching one we found before!

Fortunately for our noble cause is the fact that <keybind> tags also
contain a property, called "key."  Cursorily, I would conclude that the
value of this property represents the key combination that the user must
type in order to trigger the action contained within the keybind tags. 
Such zany combinations as "C-A-Delete" and "C-A-x" are possible.  Now,
I'm no expert, but I'm guessing the "C" and the "A" characters are
shorthand for the standard key modifiers, our friends "control" and
"alt."

So, with all that tedious research out of the way, we should now have
accumulated all the knowledge we need in order to create our own
keybinding, and have it launch the root menu.  I'll give it a shot right
now!

<keybind key="C-m">
<action name="showmenu"><menu>root</menu></action>
</keybind>

That's it!  Of course, we'd put this inside the aforementioned big
honking <keyboard> tag, along with the other keybindings.

Chris, I know this has been a long journey, so I commend you on your
valorous patience.

May you type safely, and may the concrete guide you, always,

With hugs and kisses from your fellow keybinder,

Tim Riley


[1]: GNU Project, "GREP(1)" manual page, 2003




More information about the openbox mailing list