[openbox] Can I have the root menu always open in the center of the screen?

Sébastien ml at terranean.eu
Thu Jan 23 04:39:48 EST 2014

Le 2014-01-23 à 09:30, Augustine Souza a écrit:
> On Wed, Jan 22, 2014 at 3:00 PM, Sébastien <ml at terranean.eu> wrote:
> > $ xdotool mousemove --polar 0 0 key Super_L+space
> >
> the mouse cursor moved to the center of the screen (as it should) but
> root menu did not open.
> Instead, the next terminal prompt is pushed one space to the right
> and a space is "typed" after the prompt as well.

Intriguing, I managed to reproduce that with other experiments (using
an incorrect key name followed by a letter) but not with this command.
I'm using xdotool 3.20130506.1 with Openbox 3.5.2, if it matters.

> This doesn't seem to be only with "Super_L+space". Other keybinds of
> my rc.xml, such as Super+f  (W-f) or Super-m (W-m) to open Firefox or
> Medit don't work. Instead, the letters "f" (or "m") appear in the
> terminal (as for the spaces mentioned above).

You mean that they don't work only when being invoked via this xdotool
command, right? (not that they don't work at all with a physical press
of the keys?)

Just in case, try using the "super" alias (lowercase) instead of
Super_L or Super. It should detect the correct Super key to use:
$ xdotool mousemove --polar 0 0 key super+space

Also, just for testing, instead of W/super, try to use other
modifiers such as C/control or A/alt in rc.xml/xdotool to see if
the issue resides in the Windows key.

A few other things to try (in a terminal, first)...

Explicitly specify that you want to hold super down and release it:
$ xdotool mousemove --polar 0 0 keydown super key space keyup super

With delays in case for some reason X or Openbox doesn't manage to
$ xdotool mousemove --polar 0 0 keydown --delay 150 super \ 
key --delay 150 key space keyup super

With xte (xautomation), replace "x y" by the centre of your
display since xte doesn't have a polar switch:
$ xte "mousemove x y" "keydown Super_L" "key space" "keyup Super_L"

If it doesn't recognise "key space", use "str  " (str, then two spaces):
$ xte "mousemove x y" "keydown Super_L" "str  " "keyup Super_L"

Much more a workaround than anything else done with xdotool, if you
don't mind the screen flickering once, there's something like this:
$ xdotool search --desktop 0 "" windowminimize %@\ 
mousemove --polar 0 0 sleep 0.4 click 3 windowactivate %@

It minimises all windows, right clicks on the root window, and restores
windows - it restores all of them though.

Unfortunately, neither xdotool or xte does seem to support mouse events
sent to other windows (clicking through windows).

> Anyway, I'll just use the other way of keeping a spot free at the top
> center of my screen between a little Conky strip and my tint2 panel.

By the way, you should be able to right click on Conky itself and have
the root menu (not sure which Conky setting does that or if it is by
default). So something to try if you are really motivated or desperate:

A 1x1px transparent conky window at the centre of the display,
always above all the other windows, that sends a right click to the root
window. And then have xdotool go there and right click. 

Maybe too much trouble, figuring out and fixing the xdotool super+space
command could be quicker...


More information about the openbox mailing list