feat: add cursor auto-hide feature with configurable idle delay#81
Merged
feat: add cursor auto-hide feature with configurable idle delay#81
Conversation
- Add useCursorAutoHide hook for persistent settings (enabled + delay) - Add useCursorAutoHideEffect hook for global mouse listener management - Split concerns so settings UI changes take effect without app restart - Add CursorAutoHideOption settings UI (toggle + 1–30 s delay slider) - Add CSS rules to hide cursor via html.cursor-autohide-hidden class - Register useCursorAutoHideEffect in App.tsx for app-lifetime listeners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
New files
src/features/editor/lib/cursorAutoHideConfig.ts— defaults, mutable config object, store keys, CSS class name, always-visible selectorssrc/features/editor/hooks/useCursorAutoHide.ts— two hooks:useCursorAutoHide: settings UI hook (reads/writesconfigStore, updatescursorAutoHideConfig)useCursorAutoHideEffect: effect-only hook (registers globalmousemove/mouseoverlisteners, readscursorAutoHideConfigdirectly so changes take effect without re-render)src/features/settings/ui/CursorAutoHideOption.tsx— settings UI (toggle + 1–30 s delay slider)Modified files
src/features/editor/index.ts— export both hookssrc/features/settings/ui/SettingsDialog.tsx— addCursorAutoHideOptionsectionsrc/App.tsx— calluseCursorAutoHideEffect()for app-lifetime mouse listenerssrc/index.css— addhtml.cursor-autohide-hiddenCSS rulesDesign decisions
The hook is split into two (
useCursorAutoHide+useCursorAutoHideEffect) to avoid the dual-instance problem: if a single hook managed both settings and listeners, the settings dialog component would register its own listener set that gets destroyed when the dialog closes. By keeping listeners inuseCursorAutoHideEffect(called once inApp.tsx) and sharing state via thecursorAutoHideConfigmutable object, settings changes from the UI propagate to the effect without any re-render or restart.