ssokolow / quicktile

Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
https://ssokolow.com/quicktile/
GNU General Public License v2.0
869 stars 78 forks source link

Add a "Sticky mouse pointer" feature #62

Open kekh opened 8 years ago

kekh commented 8 years ago

Ability to make the mouse pointer following the currently manipulated window.

I've needed that feature because of the "Focus follow mouse" setting in Xfce which causes bad behavior with multi display config (ie. every time I move a window via QuickTile to an other monitor I must reposition the mouse on the window to keep QuickTile moving the right window)...

As I'm not at all familiar with Python this was done (or rather tinkered) by deduction at looking your code + hours of Googling. So very sorry if it's suboptimal :-/

Anyway, thank you so much for your great software!!

ssokolow commented 8 years ago

At the moment, all my time is taken up by my degree project, but I'll leave this open as a TODO for when I can spare some time.

Thanks for taking the effort. :)

kekh commented 8 years ago

Ok no problem!

ssokolow commented 8 years ago

Also, I took a very quick glance over your code and, when I merge it, I'll probably adapt it so it also preserves the pointer's position within the active window. I don't use "focus follows pointer" (obviously), but that seems like something that would be desirable.

kekh commented 8 years ago

Great! I'm trying to refactore it in order to save you some time and perhaps improve my Python knowledge, who knows... :D

kekh commented 8 years ago

Here it is... I hope you'll find it better!

ssokolow commented 8 years ago

Actually, now that I've looked at it more closely, there are a couple of issues with that code:

  1. It's hard for me to explain why, since it's just something I developed a feel for over the years, but get_xdisplay_xroot isn't something I'd want in my code.
  2. I was actually trying to factor out the use of python-xlib as much as possible, so I'd rather you didn't add it back in as a dependency for WindowManager.

Maybe I'm too nice for the good of my own schedule, but I took a few minutes to Google up the proper APIs...

...and implemented it properly. I don't currently have time to expose the option to the end user so people can turn it off, so I can't merge it into master, but take a look at this branch (specifically, the diff of commit 10d1c5c860e647535b2747765b2e9e0c96011053), learn from it, and feel free to use it:

https://github.com/ssokolow/quicktile/tree/focus_follows_mouse

I'll leave this pull request open as a reminder to myself that I need to merge that branch.

kekh commented 8 years ago

Wow this is super cool! Thank you sooo much for taking of your time to do it!!!

ssokolow commented 4 years ago

I'm un-tagging on this temporarily "fix in dev branch" because it didn't make it into the GTK 3 rewrite that's going out as 0.4.0.

However, I've already looked up the chain of calls necessary to get a reference to the pointer and warp it under the new API, so I foresee no problem including this functionality in 0.5.0, which shouldn't take anywhere near as long.