Discussion:
[openbox] make the root-menu appear at a fixed location when opening it with a keyboard shortcut, possible?
Plmalternate Plmalternate
2014-09-21 10:54:05 UTC
Permalink
When opening the root menu with a keybinding, is it possible to have
it open in a pre-set location rather that wherever the pointer happens
to be?
TT
2014-09-21 11:29:27 UTC
Permalink
i think you would need a helper like xdotool for that.
but it would also make the mouse jump to that point i guess.
Post by Plmalternate Plmalternate
When opening the root menu with a keybinding, is it possible to have
it open in a pre-set location rather that wherever the pointer happens
to be?
_______________________________________________
openbox mailing list
openbox at icculus.org
http://icculus.org/mailman/listinfo/openbox
John Bell
2014-09-22 19:45:49 UTC
Permalink
I've tried to do this with xdotool and wmctrl and couldn't get it to work.
This functionality is at the top of my christmas wish list.
Post by TT
i think you would need a helper like xdotool for that.
but it would also make the mouse jump to that point i guess.
Post by Plmalternate Plmalternate
When opening the root menu with a keybinding, is it possible to have
it open in a pre-set location rather that wherever the pointer happens
to be?
_______________________________________________
openbox mailing list
openbox at icculus.org
http://icculus.org/mailman/listinfo/openbox
_______________________________________________
openbox mailing list
openbox at icculus.org
http://icculus.org/mailman/listinfo/openbox
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/openbox/attachments/20140922/40de59cb/attachment.html>
Sébastien
2014-09-22 20:15:29 UTC
Permalink
Post by Plmalternate Plmalternate
When opening the root menu with a keybinding, is it possible to have
it open in a pre-set location rather that wherever the pointer happens
to be?
I answered a similar question earlier this year which might help:
http://icculus.org/pipermail/openbox/2014-January/008430.html

Hope this helps,
--
Sébastien
Plmalternate Plmalternate
2014-09-23 21:13:58 UTC
Permalink
Message: 1
Date: Mon, 22 Sep 2014 14:45:49 -0500
From: John Bell <johnfbell3 at gmail.com>
To: openbox mailing list <openbox at icculus.org>
Subject: Re: [openbox] make the root-menu appear at a fixed location
when opening it with a keyboard shortcut, possible?
<CAF9_zTHH=n-b0yo7opf_rzaN9sEg3zQUk=zLacgZ2aoadc24Wg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I've tried to do this with xdotool and wmctrl and couldn't get it to work.
This functionality is at the top of my christmas wish list.
Post by TT
i think you would need a helper like xdotool for that.
but it would also make the mouse jump to that point i guess.
Post by Plmalternate Plmalternate
When opening the root menu with a keybinding, is it possible to have
it open in a pre-set location rather that wherever the pointer happens
to be?
_______________________________________________
openbox mailing list
openbox at icculus.org
http://icculus.org/mailman/listinfo/openbox
_______________________________________________
openbox mailing list
openbox at icculus.org
http://icculus.org/mailman/listinfo/openbox
-------------- next part --------------
An HTML attachment was scrubbed...
<http://icculus.org/pipermail/openbox/attachments/20140922/40de59cb/attachment-0001.html>
------------------------------
Message: 2
Date: Mon, 22 Sep 2014 22:15:29 +0200
From: Sébastien <ml at terranean.eu>
To: openbox at icculus.org
Subject: Re: [openbox] make the root-menu appear at a fixed location
when opening it with a keyboard shortcut, possible?
Message-ID: <20140922221529.27667562 at sentinel>
Content-Type: text/plain; charset=UTF-8
Post by TT
When opening the root menu with a keybinding, is it possible to have
it open in a pre-set location rather that wherever the pointer happens
to be?
http://icculus.org/pipermail/openbox/2014-January/008430.html
Hope this helps,
--
Sébastien
------------------------------
Thank you all, gentlesapients.
Here is what I got to work:

I set a keybinding to this bash script:

#! /bin/bash
xte 'mousemove 3 3'
sleep 1
xte 'mouseclick 3'

The "xte 'mousemove 3 3'" puts the pointer in a space occupied by a
small conky window, which passes any click on to the root window.

The "sleep 1" gives me enough time to get my fingers off the keys
before the following "xte 'mouseclick 3'", which is a right click.
Otherwise the right click is modified by the key or keys still being
held down. I'd love to have a more elegant way to do this, both so
that I wouldn't have to remember to release the keys promptly, and so
the menu would pop up quicker, but so far that's the best I've come up
with.

The trickiest part was finding a keybinding that wouldn't be
intercepted by any application likely to have a focused window. Partly
for this reason, I hate programs having keybindings enabled by
default. Is there some way to to give Openbox priority, so that it
intercepts all keybound combinations and only passes them on to the
application with the focused window if the keybound combination isn't
specified in ~/.config/openbox/rc.xml, or maybe even better, doesn't
pass them on at all, or perhaps best of all, passes on only specified
keycodes to specified applications? Like for instance, specify in
rc.xml something like "If gedit has focus, pass on control-c and
control-v, but don't pass on anything I haven't explicitly told you
to."

One can always find some ridiculously complicated key combination that
none of your programs use, but I much prefer to have a small set of
higly mnemonic keybindings, rather than a huge number of arbitrary
ones. I'm not sure what the custom of this list in on
thread-topic-drift. If I should have posted these follow-ups as
seperate topics, please say so and I'll try to conform to native
customs as best as I understand it. Thanks.
Anthony Thyssen
2014-09-23 23:38:38 UTC
Permalink
On Tue, 23 Sep 2014 17:13:58 -0400
Plmalternate Plmalternate <plmalternate at gmail.com> wrote:
|
| > Date: Mon, 22 Sep 2014 22:15:29 +0200
| > From: Sébastien <ml at terranean.eu>
| >
| > le 2014-09-21 à 06:54, Plmalternate écrivit:
| >> When opening the root menu with a keybinding, is it possible to have
| >> it open in a pre-set location rather that wherever the pointer happens
| >> to be?
| >
| > I answered a similar question earlier this year which might help:
| > http://icculus.org/pipermail/openbox/2014-January/008430.html
| >
| > Hope this helps,
| > Sébastien
|
|
| Thank you all, gentlesapients.
| Here is what I got to work:
|
| I set a keybinding to this bash script:
|
| #! /bin/bash
| xte 'mousemove 3 3'
| sleep 1
| xte 'mouseclick 3'
|
| The "xte 'mousemove 3 3'" puts the pointer in a space occupied by a
| small conky window, which passes any click on to the root window.
|
| The "sleep 1" gives me enough time to get my fingers off the keys
| before the following "xte 'mouseclick 3'", which is a right click.
| Otherwise the right click is modified by the key or keys still being
| held down. I'd love to have a more elegant way to do this, both so
| that I wouldn't have to remember to release the keys promptly, and so
| the menu would pop up quicker, but so far that's the best I've come up
| with.
|
Keyboard bindings or macros, are difficult things, especially when many
programs have there own, often weird, keybindings.

For consistency I tend to make all my global key bindings 'Meta'
shifted (The 'window key' on my keyboard).

My own notes on keyboard bindings are published in
http://www.ict.griffith.edu.au/anthony/info/X/event_handling.txt

And it also focuses on using "xte" (from the xautomation package)
but to generate keyboard macros.

For example, I press Meta-F1 and my email address is typed in whatever
window the pointer is in, even input windows that does NOT accept
'paste' events normally!

I also had problems with having to release 'shifting' keys quickly
which is another reason why 'meta' is a good one as it is normally
completely ignored by many programs. (not Firefox!)

Look for the section "The Bigger Problem: Modifiers"

Basically...
The "xdotool" has a --clearmodifiers option

This was added for this very reason!

WARNING: Watch out for "Recursive Macros"... :-)


What we really need is a tool that can both wait for specific events
AND then send events. EG: wait for keys to be released, and then
apply events or run a program. But it seems such a tool is very
tricky to create, and only used by advanced X window users.




Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
--------------------------------------------------------------------------
Take this cheese to sick bay!!!
The Doctor should have a look at it.
-- StarTrek Voyager "Training"
--------------------------------------------------------------------------
Anthony's Castle http://www.ict.griffith.edu.au/anthony/
Ian Zimmerman
2014-10-01 06:51:06 UTC
Permalink
On Wed, 24 Sep 2014 09:38:38 +1000,
Post by Anthony Thyssen
For consistency I tend to make all my global key bindings 'Meta'
shifted (The 'window key' on my keyboard).
I guess you're an Emacs infidel, then :-P Beware!

Myself, I have Meta = Alt, Super = Window, and bind the latter
exclusively to WM things. One of my eternal complaints against most
other WMs (especially those built into "intergrated" desktops, ahem) is
that they hardcode the obnoxious M$ Alt-Tab for window switching thus
putting it out of reach of my deity.

The possibility of reconfiguring that is also one of the first things I
check to see if a system is even worth trying.
--
Please *no* private copies of mailing list or newsgroup messages.
Local Variables:
mode:claws-external
End:
Anthony Thyssen
2014-10-01 23:13:25 UTC
Permalink
On Tue, 30 Sep 2014 23:51:06 -0700
Ian Zimmerman <itz at buug.org> wrote:
| On Wed, 24 Sep 2014 09:38:38 +1000,
| Anthony Thyssen <A.Thyssen at griffith.edu.au> wrote:
|
| > For consistency I tend to make all my global key bindings 'Meta'
| > shifted (The 'window key' on my keyboard).
|
| I guess you're an Emacs infidel, then :-P Beware!
|
Emacs.... Gad no.. (Present sign against evil)


| Myself, I have Meta = Alt, Super = Window, and bind the latter
| exclusively to WM things. One of my eternal complaints against most
| other WMs (especially those built into "intergrated" desktops, ahem) is
| that they hardcode the obnoxious M$ Alt-Tab for window switching thus
| putting it out of reach of my deity.
|
Tell me about it...

If I logout, the only way to login is to select the username and
password boxes on the login screen. But that requires a mouse.
Without the mouse you need to use that obscure Alt-Tab to get the input
window highlighted! even though it is the primary purpose of the
whole display!

It took me 6 months to figure out a non-mouse method to 'login'
and even then I find it very in-convenient!

Note I don't use gnome window manager at any other time! I don't even
know why they even considered a window manager was necessary for a
dedicated login screen! It never used to be the case before this.

To me it just provides something else that could break, or be 'hacked'
on the login screen. Not that anyone hacks things when standing in
front of the computer anymore.

| The possibility of reconfiguring that is also one of the first things I
| check to see if a system is even worth trying.
|
I just don't use it! That is why I use Openbox. Something that is
reconfigurable to do what I want, and not what some developer 'thinks'
I want.





Anthony Thyssen ( System Programmer ) <A.Thyssen at griffith.edu.au>
--------------------------------------------------------------------------
"What was that?" Jerry asked, peering over the edge.
"I think it was a ninja dwarf." Wiz said wonderingly...
-- Rick Cook, "Wizardry Cursed"
--------------------------------------------------------------------------
Anthony's Castle http://www.ict.griffith.edu.au/anthony/
Micha
2014-10-03 20:58:23 UTC
Permalink
Hi folks !
I don't know, how to step into an active subject, hope this will appear
where it belongs to.:-[
When I first read the posts of this topic, I wouldn't believe, that there is
any problem achieving such behaviour.
But then I realized, there are two different actions involved:
1.: Setting the pointer ( with Xdotool )
2.: Calling the root-menu

In the OB rc.xml, this would need 2 action-tags( "execute" and "show-menu" )
performed inside one keybind-tag.
I've tested it, and both actions were working, but not together !
The pointer was placed correctly, but the root-menu was displayed at the
former pointer coordinates.
Maybe, putting the xdotool-call into a Bash script, with a little sleep
at the
end might help to place the menu at the new coordinates.

But I ended with this weird workaround:
I just created one shortcut for the moderated menu positioning, and a
second one for the normal menu-call.
The part of the rc.xml looks like that :
...
<keybind key="W-r">
<action name="ShowMenu">
<menu>root-menu</menu>
</action>
</keybind>
<keybind key="W-j">
<action name="Execute">
<execute>xdotool mousemove 200 100 key super+r</execute>
</action>
</keybind>
...
With W(indows)-r, the root-menu is placed at the current pointer, and with
W-j, Xdotool is called, which first places the pointer at the new position,
and then simulates the W-r shortcut, which places the root-menu at the
pointer position.

Hope this helps,

Micha
Mikael Magnusson
2014-10-04 04:27:58 UTC
Permalink
Post by Micha
Hi folks !
I don't know, how to step into an active subject, hope this will appear
where it belongs to.:-[
When I first read the posts of this topic, I wouldn't believe, that there is
any problem achieving such behaviour.
1.: Setting the pointer ( with Xdotool )
2.: Calling the root-menu
You guys know openbox is open source right? There's no need for these
awful hacks proliferating, you can just add a parameter to the
showmenu action.
--
Mikael Magnusson
TT
2014-10-06 05:43:55 UTC
Permalink
Post by Mikael Magnusson
Post by Micha
Hi folks !
I don't know, how to step into an active subject, hope this will appear
where it belongs to.:-[
When I first read the posts of this topic, I wouldn't believe, that there is
any problem achieving such behaviour.
1.: Setting the pointer ( with Xdotool )
2.: Calling the root-menu
You guys know openbox is open source right? There's no need for these
awful hacks proliferating, you can just add a parameter to the
showmenu action.
You mean like this? =>
<mousebind action="Press" button="Right">
<action name="ShowMenu">
<menu>root-menu</menu>
<position force="yes">
<x>100</x>
<y>100</y>
</position>
</action>
</mousebind>
For a moment i thought, wow, could it be that simple...
but unfortunately it doesn't work that way.
the actual current position of the mouse pointer takes precedence.

but in a way i agree --
why does one need to create hacks to have the root menu at a certain
position?
-- i think this is rather a case of adjusting your habits.
Mikael Magnusson
2014-10-06 10:18:14 UTC
Permalink
Post by TT
Post by Mikael Magnusson
Post by Micha
Hi folks !
I don't know, how to step into an active subject, hope this will appear
where it belongs to.:-[
When I first read the posts of this topic, I wouldn't believe, that there is
any problem achieving such behaviour.
1.: Setting the pointer ( with Xdotool )
2.: Calling the root-menu
You guys know openbox is open source right? There's no need for these
awful hacks proliferating, you can just add a parameter to the
showmenu action.
You mean like this? =>
<mousebind action="Press" button="Right">
<action name="ShowMenu">
<menu>root-menu</menu>
<position force="yes">
<x>100</x>
<y>100</y>
</position>
</action>
</mousebind>
For a moment i thought, wow, could it be that simple...
but unfortunately it doesn't work that way.
the actual current position of the mouse pointer takes precedence.
but in a way i agree --
why does one need to create hacks to have the root menu at a certain
position?
-- i think this is rather a case of adjusting your habits.
I mean that, and write the code, and send the patch here. :)
--
Mikael Magnusson
Micha
2014-10-06 13:03:22 UTC
Permalink
Nice, that you have such a high opinion of us !
Messing around with OB's source code is way too hard, for me
at least. I'm more focussing on smaller projects, and menu scripts
or pipemenus.
But where do you see any hacks here ?
IMHO, hacks are used in the program code, and this here is just about
a special way, using a program.
And it is common practice, to use OB with several of these little helper
tools, like Wmctrl, Xdotool and others.

Micha
Mikael Magnusson
2014-10-06 18:42:35 UTC
Permalink
Post by Micha
Nice, that you have such a high opinion of us !
Can't blame me for having some small hope. Anyway, I realized that
although it is very simple to add a simple option to just use an
absolute number, it was a bit more work to use the existing code that
allows you to say things like 2/3 and -500 to put stuff at 2/3rds of
the specified desktop, aligned from the right edge on so on, so I took
pity on you guys and implemented it.

http://comm.it.cx/cgit/openbox/log/?h=work top six commits here, or
squashed into a single patch here,
http://comm.it.cx/cgit/openbox/patch/?id=8124401

I've only tested this lightly, so let me know if something breaks. The
specified position will not take effect for mouse binds, and will not
take effect if the menu shown is client-menu (it always shows up under
the titlebar of the window it belongs to).
--
Mikael Magnusson
Micha
2014-10-10 18:38:43 UTC
Permalink
Post by Mikael Magnusson
Post by Micha
Nice, that you have such a high opinion of us !
Can't blame me for having some small hope. Anyway, I realized that
although it is very simple to add a simple option to just use an
absolute number, it was a bit more work to use the existing code that
allows you to say things like 2/3 and -500 to put stuff at 2/3rds of
the specified desktop, aligned from the right edge on so on, so I took
pity on you guys and implemented it.
http://comm.it.cx/cgit/openbox/log/?h=work top six commits here, or
squashed into a single patch here,
http://comm.it.cx/cgit/openbox/patch/?id=8124401
I've only tested this lightly, so let me know if something breaks. The
specified position will not take effect for mouse binds, and will not
take effect if the menu shown is client-menu (it always shows up under
the titlebar of the window it belongs to).
Not my topic here, but I think, someone should acknowledge your patch
at least, well done !

Though not obvious, but there are situations, where placing a menu e.g. at
the center can become handy.
When you watch fullscreen videos, or you are working inside a window, maybe
you shove the mouse pointer out of your view.
If you now call a menu by shortcut, you first have to search around the
screen
edges, to find the menu. Here a fixed shortcut-menu position is useful.

Frankly, I've not tested the patch, I don't even know, which is the
current OB version.

Keep on with your great work,

Micha

Loading...