Closed emanuele6 closed 5 years ago
The issue there is most likely that the "button down" event is registered by polybar and not xmmv. I only read the code quickly, but it seems that xmmv has to register for the button down event to start moving the window "dynamically".
Try to force a "button up" event in your script before calling xmmv, eg. with xdo
. That could work.
The issue there is most likely that the "button down" event is registered by polybar and not xmmv.
As I said the "button down" event seems to be registered by the window that is being moved ("goes to the window"): if I am moving a terminal, I can highlight lines with double click; if I am moving a browser window, I can click on links.
Try to force a "button up" event in your script before calling xmmv, eg. with xdo. That could work.
I am not sure on how to do that with xdo
, I used xdotool
instead, but it didn't work.
#!/bin/bash
wid="$(pfw)"
xdotool mouseup 1
xmmv "$wid"
EDIT: I figured out how to use xdo button_release
, it doesn't work:
#!/bin/bash
wid="$(pfw)"
xdo button_release -k 1
xmmv "$wid"
The issue is that xmmv
doesn't work if you call it while a mouse
button is held down. If you try it in a terminal console, you'll
reproduce the bug you encounter with your bar.
A hack is to modify the bar to call the program on BUTTON_RELEASE
rather than BUTTON_PRESS
. This is only a hack though.
I don't know why we get such a behavior. This is probably related to the fact we grab the event from the root window. But I honestly have no clue where to look at now.
So I looked into this, and this is not an issue with xmmv
by itself.
In order to do its job, xmmv
must grab the pointer on the root windows to detect any move it does. Under X11, you simply cannot grab the pointer while a button is down.
In your case, the only possibke fix are as follow:
sleep(1)
call to your script to give you enough time to release the mouse buttonxmmv
on MOUSE_RELEASE events rather than MOUSE_PRESSI'm closing this issue asit is not a bug in xmmv
.
When
xmmv
is called frompolybar
, it does not work properly: the window follows the cursor, but the window is not placed on keydown: the keydown just "goes to the window" (you will have to runkillall xmmv
to "place the window")How to reproduce
xmmv
[module/my_button] type = custom/text content = I_AM_A_BUTTON click-left = /path/to/script
[bar/minimal] modules-center = my_button
[module/my_button] type = custom/text content = I_AM_A_BUTTON click-left = /path/to/script
EDIT: In order to reproduce the bug you also need to make
/path/to/script
executable:chmod +x /path/to/script
I also tried:
but it didn't fix the issue. And I also tried:
I clicked on the window during the 2 seconds of sleep and it did fix the issue.