Goal
I am trying to hide the cursor after a certain timeout (probably three seconds) has passed and the mouse wasn’t moved.
Operators
For that I use javascript, which applies a class to the body
element to hide the cursor. It also shows the cursor again by removing said class, if the cursor is moved.
Issue
The code seems to be applied (the class is properly added and removed, according to the dev tools), but the cursor still stays there and is visible.
Just adding the following css manually doesn’t work either (but does work on firefox based browsers):
body {
cursor: none !important;
}
Questions
- Why does it not work for Anki?
- How can I make it work?
Related
Edit: I also found this addon: Hide Cursor When Idle.
Edit 2: The addon uses the same method and also doesn’t work for me:
def _hideCursor(self):
if hasattr(mw, 'web'):
mw.web.eval("""
document.body.style.setProperty('cursor', 'none', 'important');
""")
def _showCursor(self):
if hasattr(mw, 'web'):
mw.web.eval("""
document.body.style.setProperty('cursor', 'auto', 'important');
""")
Edit 3:
It doesn’t work for me on at least all of the following anki versions:
- Latest anki build today from source and branch main.
Anki 25.05 (8fc822a6) (src) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.12.19-amd64-x86_64-with-glibc2.41
- Former stable:
Anki 25.02 (038d85b1) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.12.19-amd64-x86_64-with-glibc2.41
- Former stable:
Anki 24.11 (87ccd24e) (ao)
Python 3.9.18 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.1.0-0.deb11.21-amd64-x86_64-with-glibc2.31