elcste / hide-cursor

GNOME Shell extension to hide the cursor on inactivity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cursor sometimes disappears immediately after movement

rootsh0pf opened this issue · comments

The extension works really well so far, thank you! :)
But it seems, the 5 seconds are not always counted correctly:
Sometimes the cursor disappears immediately after the movement and sometimes after just one second.

You're welcome. It was really the one thing I was missing when switching to Wayland.

I thought I've noticed that too but I didn't look systematically, so thanks for the confirmation.

I think there's a flaw relating to linking the code that sets the 5 second timer with the code that hides the cursor. As I have very minimal javascript skills, I haven't thought of a better idea however. I am very open to collaboration or suggestions however :-)

The problem is that the status is checked after every 5 seconds. If it checks at 10 and you stop moving your cursor at 14, then only 1 second will be elapsed when it checks again at 15 again and the cursor disappears.

I have made an attempt to fix this in #3 by introducing 2 callbacks instead: one checks every second for the status and the other resets the clock on every cursor move. Let's test how it goes then.

@iago-lito Thanks for working on this. What you describe better articulates what I thought was happening but lack the knowledge to fix.

I tried your version but it will not enable for me with the error

ReferenceError: tracker is not defined

(For the record I tested on Ubuntu Oracular with GNOME 47 beta 1).

Yupe, sorry @elcste there are a few dummy mistakes in there yet because I'm not exactly confident how to try the extension without restarting my whole session so I haven't tested it at all. I'll tell you when I'm happy with it :)

[EDIT] Should be working now (at least it does on my side ;)

Thanks to @iago-lito's contribution, seems to be solved with 6dfe743!

Created a release here and submitted to EGO for review.

It is live on EGO.

I realize I never tested myself on GNOME 45, only 46 and (the pre-release of) 47. I've made the new version active for 45 but I will reactivate the old version or something if someone reports an issue.