fix: use Cmd+Shift+Q for Quit Completely, fix app menu quit handler#3810
Merged
fix: use Cmd+Shift+Q for Quit Completely, fix app menu quit handler#3810
Conversation
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…date timers, extract makeLabel Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…d gesture Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
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
Fixes two issues with "Quit Completely" after PR #3696:
Misleading shortcut label: Both the app icon menu and tray icon menu showed
⌘Qfor "Quit Completely", but⌘Qis intercepted by the Swift overlay (press to close / hold to quit). Changed the accelerator to⌘⇧Q.App icon menu "Quit Completely" didn't actually quit: Clicking "Quit Completely" in the app icon menu was intercepted by
ExitRequestedand just hid the dock — it never calledTrayQuit::handlebecause only the tray icon had anon_menu_eventhandler. Replaced the tray-level handler with a single app-levelon_menu_eventonAppHandleso both app menu and tray menu clicks route throughHyprMenuItem::handle.Restored window closing in
ExitRequested: Brought back thewindow.close()loop that was removed in Replace Cmd+Q hide behavior with hold-to-quit overlay #3696, so intercepted exit requests also close all windows before hiding the dock icon.Swift interceptor now intercepts
⌘⇧Qdirectly:handleKeyDownconsumes⌘⇧Qand callsperformQuit()immediately, preventing macOS from triggering its built-in "Log Out" system dialog. The⌘⇧Qmenu accelerator label remains as a visual hint only — the actual keyboard shortcut is handled entirely in Swift.Refactored Swift
QuitInterceptor: RemovedEventenum andtransition()dispatch in favor of directonCmdQPressed()/onKeyReleased()methods. Consolidated four timer functions into genericscheduleTimer/cancelTimerhelpers. ExtractedmakeLabelto reduce duplication in view construction. Net -24 lines.Review & Testing Checklist for Human
⌘⇧Q(keyboard) triggers Swift'sperformQuit()→rustSetForceQuit()→NSApplication.shared.terminate(nil). Clicking "Quit Completely" (menu) triggers Rust'sTrayQuit::handle()→kill_processes_by_matcher()→set_force_quit()→app.exit(0). Verify both paths clean up properly (kill child processes, save state, etc.). Notably, the Swift keyboard path does not callkill_processes_by_matcher()— confirm this is acceptable or if it needs to be added.⌘⇧Qis intercepted before macOS Log Out dialog:addLocalMonitorForEventsonly sees events delivered to the app. If macOS intercepts⌘⇧Qat the system level first, the Swift interceptor won't help. Test that pressing⌘⇧Qquits the app without showing the macOS "Log Out" dialog.⌘Q→ overlay should appear ("Press ⌘Q to Close" / "Hold ⌘Q to Quit")⌘⇧Q→ app should quit immediately (no Log Out dialog)self.state == .awaitingguard — verify the overlay still auto-dismisses after 1.5s if you press ⌘Q once and release.on_menu_eventreceives tray menu events: The tray-levelon_menu_eventwas removed entirely. Confirm tray menu items still work via the app-level handler.Notes