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

Implement Cursor Hiding While Typing & Cursor Inactive Timeout (#284) #709

Merged
merged 4 commits into from
Oct 7, 2024

Conversation

yzy-1
Copy link
Contributor

@yzy-1 yzy-1 commented Oct 2, 2024

This pull request addresses the discussion on #284 regarding cursor management in niri. Specifically, I have implemented the second solution: hiding the cursor while typing.

The implementation of cursor timeout (solution 1) would require active polling to check the remaining time, which is not straightforward given our current design where all cursor-related updates are triggered by events. Implementing this approach would involve finding a suitable place in the codebase to handle the periodic checks, which I found challenging due to the existing event-driven architecture.

In contrast, hiding the cursor while typing (solution 2) can be seamlessly integrated as it aligns with the existing event-driven model. This implementation is more straightforward and reduces potential complexity.

Please review the changes and let me know if any further adjustments are needed.

Copy link
Owner

@YaLTeR YaLTeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems rather straightforward and simple. As long as it works for the people who want this functionality.

Implementing this approach would involve finding a suitable place in the codebase to handle the periodic checks, which I found challenging due to the existing event-driven architecture.

Sounds similar enough to the idle notifier code. That one's refreshed on every input event, but the cursor one could be refreshed on every pointer event instead.

src/input/mod.rs Outdated Show resolved Hide resolved
@yzy-1

This comment was marked as resolved.

@yzy-1
Copy link
Contributor Author

yzy-1 commented Oct 4, 2024

I check cursor timeout in function refresh_pointer_outputs and now it succeeds and works perfectly fine.

@yzy-1 yzy-1 changed the title Implement Cursor Hiding While Typing (#284) Implement Cursor Hiding While Typing & Cursor Inactive Timeout (#284) Oct 4, 2024
niri-config/src/lib.rs Outdated Show resolved Hide resolved
src/input/mod.rs Outdated Show resolved Hide resolved
src/input/mod.rs Outdated Show resolved Hide resolved
src/niri.rs Outdated Show resolved Hide resolved
@yzy-1
Copy link
Contributor Author

yzy-1 commented Oct 6, 2024

OK. I resolved them all.

@YaLTeR
Copy link
Owner

YaLTeR commented Oct 6, 2024

I did some fixes, and I also had to reimplement the inactivity hiding as a timer after all, since otherwise it would fire late due to refresh() simply not being called when nothing is happening. Please test that this still works for you; otherwise it's good to merge.

@yzy-1
Copy link
Contributor Author

yzy-1 commented Oct 7, 2024

It worked perfectly! Thank you!

YaLTeR and others added 4 commits October 7, 2024 08:01
Feels like this should be the case.
The previous way was prone to triggering late due to compositor idling
and therefore never calling the check function.
@YaLTeR YaLTeR enabled auto-merge (rebase) October 7, 2024 05:02
@YaLTeR YaLTeR merged commit 03c6039 into YaLTeR:main Oct 7, 2024
10 checks passed
@YaLTeR
Copy link
Owner

YaLTeR commented Oct 7, 2024

Thanks

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

Successfully merging this pull request may close these issues.

2 participants