Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the moure too fast will focus center #4

Open
c60cb859 opened this issue Nov 24, 2023 · 3 comments
Open

Using the moure too fast will focus center #4

c60cb859 opened this issue Nov 24, 2023 · 3 comments

Comments

@c60cb859
Copy link

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
Copy link
Owner

basaran commented Nov 24, 2023

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
Copy link
Author

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
Copy link

shmilee commented Jun 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants