wmutils / core

Set of window manipulation tools
Other
714 stars 33 forks source link

wmv/wrs mouse coords read on socket #35

Closed kanbara closed 8 years ago

kanbara commented 8 years ago

sxhkd had a commit which removes the integer conversion of mouseX events. As a result, wmv/wrs can no longer retrieve coordinates. There's a functionality added to read a socket in sxhkd, so I tried to check how bspwm (bspc pointer) was reading pointer events but didn't quite figure it out yet.

If you have any code suggestions (or simply config ones) I'd love to get to the bottom of this.

z3bra commented 8 years ago

That's an annoying commit.. We can live without the x,y coordinate expansion by using $(wmp) instead of %i %i, but the command won't be replayed every x milliseconds, making the command useless. I looked at bspwm code, and it doesn't make use of a socket to pass on the coordinates.

Upon pressing the key, it tells the WM "Hey, start moving/resizing the window", and upon releasing the keys: "Stop moving/resizing it, and release the cursor".

Nothing exploitable with wmutils. I need to think about it to find a solution using tools in the core repo only, but for now, the only viable solution is xmmv in the contrib repo.

thanks for reporting the issue.

kanbara commented 8 years ago

Cheers.

Yeah, I'll look into it... though it looks like `xmmv' was removed in 74badd. I come from i3 so I'm sure I'll manage, as I rarely use the mouse, but I was going through peoples' dotfiles when I noticed it.

z3bra commented 8 years ago

Jay wrote:

Cheers.

Yeah, I'll look into it... though it looks like `xmmv' was removed in 74badd. I come from i3 so I'm sure I'll manage, as I rarely use the mouse, but I was going through peoples' dotfiles when I noticed it.

After reading a bit through sxhkd source code, it looks like you can make it write the pointer's coordinates to a socket, using a formatted string ('X' and 'Y' will be replaced by the coordinates, like "%i %i" before the update).

That will be hard to use correctly with wmutils, but it is perfect for bspwm which reads commands from a socket. The user only has to tell "start executing commands from the socket" and "stop executing commands from the socket" (namely, bspc -g/bspc -u).

There might be a solution working with wmutils, using a wrapper script; something amongst those lines:

#!/bin/sh

MAGIC=0xdeadca7
SOCKET=/tmp/sxhkd.sock

tail -n0 -f $SOCKET | while read cmd; do
    test "$cmd" = "$MAGIC" && exit 0 || $cmd
done

Running the script will start moving/resizing (depending in the template given to sxhkd). Stopping the movement would be as easy as:

echo 0xdeadca7 > /tmp/sxhkd.sock

Disclaimer: I didn't test anything, but I see no reason why it would fail.

z3bra commented 8 years ago

Closed as not an issue.