joewing / jwm

Joe's Window Manager
http://joewing.net/projects/jwm
MIT License
529 stars 85 forks source link

Opening jwm menu from command line? #439

Open ghost opened 6 years ago

ghost commented 6 years ago

Can I open the jwm menu at a specific x, y coordinate from the command line? I am using tint2 as my panel and I would like to create a launcher to do the menu I have.

In general, is there a way to do jwm commands that is bound to keyboard or mouse directly form command line?

technosaurus commented 6 years ago

I've use xdotool for this kind of stuff - even made a GUI frontend for mupdf with it and gtkdialog (a Puppy linux app for gtk+ GUIs). Another user on the puppy linux forum (sc0ttman) did a lightweight gtk frontend for vlc.

ghost commented 6 years ago

Thanks @technosaurus I have used xdotool previously for this. But the problem was that hitting the button on the left edge vs right edge cause the menu to come at two different locations. That seemed a bit hacky. as long as within the button, if the Menu comes at a certain specific X-Y coordinates, then that just works for me. I will revisit this problem with xdotools to see if it can be solved.

Edit: Finally I used xdotool mousemove x y to position the mouse a fixed position.

ghost commented 6 years ago

Right now I am using the xdotool to use the key-binding to root:1. It automatically selects the first item in the jwm menu. Is there any way this can be avoided? The reason is that it is non-intuitive for the user because the mouse location just changes arbitrarily.

I notice that when we do a Desktop - Left Click, the jwm menu comes up without selecting any item. How can we achieve that using key bindings? Is there something other than root:1 that can be used?

technosaurus commented 6 years ago

You can the key bindings for any root menu. Currently 0-9,a-z(currently case insensitive, but that could change) http://joewing.net/projects/jwm/config-2.3.shtml#keys

I think Joe made some changes to the root menu code relatively recently regarding where the submenus are positioned when the parent is clicked, but I don't know if that applies to access via keyboard shortcut. I really need to rebase my stb_image/nanosvg patches to current, but I agree, the root menu should go under the mouse with the keyboard shortcut.

This is a common UI problem related to xdotool. Most devs (who are typically extensive keyboard users) assume that if an interface is reached via a keyboard shortcut, the user prefers a keyboard centered interface. When xdotool issues a keyboard shortcut when a user clicks on the executable that runs it, all sorts of assumptions get broken. I think jwm needs to select some entry so that keyboard navigation is "intuitive". I wonder if you can designate an unused "immaginary" mouse button to a root menu (greater than 5 or is it 7? - are there horizontal scroll wheels now?)

BTW if you ever need an xdotool-like tool for windows, autoit is pretty good. For a really annoying example (attempt to simulate what it is like to have Parkinsons) see: autoit and xdotool

ghost commented 6 years ago

Thanks @technosaurus! Really appreciate your response. Yes, I think there are some areas that need to improve with regards to this. I will try out the new branch. I will check "autoit" if ever I use Windows :-) Currently, I don't think I need one because it is very heavy for me especially since I am learning. Anyways, it is nice to see that it can actually help in things like Parkinson diagnosis, that really is some worthy use case.