basaran / awesomewm-micky

an awesomewm module to automatically move and center your mouse cursor to the active (focused) window.
12 stars 2 forks source link

Using the moure too fast will focus center #4

Open c60cb859 opened 10 months ago

c60cb859 commented 10 months ago

Expected behavior

I expect the "plug-in" to not touch my cursor when moving the mouse

Actual behavior

If you move the mouse fast back and forth over a border between two windows, is will catch the cursor and center it in one of the windows. This is not really a problem until you have a floating window, where you move the cursor normal speed across two window borders and the script then catches the cursor and center it to the window.

The cursor is not centered if it just moved very slow over borders.

Steps to reproduce the behavior

Looking at the picture below, moving the cursor with the mouse from the floating window 1 to 3 just at normal speed will trigger the script to center the mouse in window 3

image

Solution

I am not sure about the best solution, I assume it is not possible to see how a focus was changed to only trigger if focus changed due to a jump command and not the mouse moving into the window..

basaran commented 10 months ago

x11 allows applications to set window their types and roles. Some application do set it, and some might not. For those who set their type and role accordingly for popups, it is possible to disable the centering. _NET_WM_WINDOW_TYPE and WM_TRANSIENT_FOR which can both be accessed with the client class. With some if statements, jumping can be disabled for popups.

Detecting the mouse movement is tricky, and would require fiddling with the timers, but an alternative might be to disable the centering when a click is detected.

c60cb859 commented 10 months ago

yea, another "hack" could be to change the micky to only be active on my move keymaps.. I can se from the comment that it worked like that before

shmilee commented 3 months ago

Based on basaran's code, I also rewrote a similar micky : https://github.com/shmilee/awesome-away/blob/master/third_party/micky.lua Then add this in my key bindings to enable/disable centering.

awful.key({ modkey, "Control" }, "c", micky.toggle,
    { description = "toggle cursor follows client", group = "client" })

@c60cb859 It will not touch the cursor when moving the mouse. You can have a look at micky.all_registered_rules (set class, signal, and corresponding handle function), and add/delete or write new rules based on your requirements.