[GH-ISSUE #103] CMD+W doesn't close the window on MacOS #76

Open
opened 2026-02-28 14:30:26 +03:00 by kerem · 9 comments
Owner

Originally created by @charlie-collard on GitHub (Aug 17, 2021).
Original GitHub issue: https://github.com/jpochyla/psst/issues/103

Shows this in the console:

2021-08-17 19:46:44.745 psst-gui[50871:1024983] +[DruidView doCommandBySelector:]: unrecognized selector sent to class 0x7f7f3e56b220
Originally created by @charlie-collard on GitHub (Aug 17, 2021). Original GitHub issue: https://github.com/jpochyla/psst/issues/103 Shows this in the console: ``` 2021-08-17 19:46:44.745 psst-gui[50871:1024983] +[DruidView doCommandBySelector:]: unrecognized selector sent to class 0x7f7f3e56b220 ```
Author
Owner

@Kethku commented on GitHub (Aug 17, 2021):

I'm not sure this is a bug. IMHO ctrl-w is reserved for closing tabs or windows for applications which have multiple identical components.

<!-- gh-comment-id:900628024 --> @Kethku commented on GitHub (Aug 17, 2021): I'm not sure this is a bug. IMHO ctrl-w is reserved for closing tabs or windows for applications which have multiple identical components.
Author
Owner

@Stooovie commented on GitHub (Aug 17, 2021):

I'm not sure this is a bug. IMHO ctrl-w is reserved for closing tabs or windows for applications which have multiple identical components.

that's for windows. in macos, that's been cmd-w since before windows even existed.

<!-- gh-comment-id:900662483 --> @Stooovie commented on GitHub (Aug 17, 2021): > I'm not sure this is a bug. IMHO ctrl-w is reserved for closing tabs or windows for applications which have multiple identical components. that's for windows. in macos, that's been cmd-w since before windows even existed.
Author
Owner

@Kethku commented on GitHub (Aug 17, 2021):

In that case, this is an upstream issue I believe. If its truly universal, then it should be handled in druid I think

<!-- gh-comment-id:900677441 --> @Kethku commented on GitHub (Aug 17, 2021): In that case, this is an upstream issue I believe. If its truly universal, then it should be handled in druid I think
Author
Owner

@JuliDi commented on GitHub (Aug 18, 2021):

This could be fixed by adding a hotkey that sends command::CLOSE_WINDOW(https://docs.rs/druid/0.7.0/druid/commands/constant.CLOSE_WINDOW.html). However, this is not intended behaviour for druid on macOS (see https://docs.rs/druid/0.7.0/druid/platform_menus/mac/application/index.html).

While implementing the cmd+h HIDE_WINDOW shortcut yesterday, I have also briefly added cmd+w to send CLOSE_WINDOW, however, I figured that closing the window doesn't make any sense if you don't want to quit the entire application – the window is gone and so are all your controls. How would you bring back the window once it's closed?
What would be your expected behaviour when pressing cmd+w?

Note: I am not sure why the default menu is overridden (entirely?) by psst since I don't understand the comment in github.com/jpochyla/psst@1d5cf324ef/psst-gui/src/ui/menu.rs (L23-L25)

<!-- gh-comment-id:901128716 --> @JuliDi commented on GitHub (Aug 18, 2021): This could be fixed by adding a hotkey that sends `command::CLOSE_WINDOW`(https://docs.rs/druid/0.7.0/druid/commands/constant.CLOSE_WINDOW.html). However, this is not intended behaviour for druid on macOS (see https://docs.rs/druid/0.7.0/druid/platform_menus/mac/application/index.html). While implementing the cmd+h `HIDE_WINDOW` shortcut yesterday, I have also briefly added cmd+w to send `CLOSE_WINDOW`, however, I figured that closing the window doesn't make any sense if you don't want to quit the entire application – the window is gone and so are all your controls. How would you bring back the window once it's closed? What would be your expected behaviour when pressing cmd+w? Note: I am not sure why the default menu is overridden (entirely?) by psst since I don't understand the comment in https://github.com/jpochyla/psst/blob/1d5cf324ef4acd7eac1c5bb5b56ca059e494c670/psst-gui/src/ui/menu.rs#L23-L25
Author
Owner

@henrymoulton commented on GitHub (Aug 18, 2021):

CMD + W would close the window but leave music running and the "mini player" active in the top OS menu bar.

CMD + Q would kill everything.

<!-- gh-comment-id:901133088 --> @henrymoulton commented on GitHub (Aug 18, 2021): CMD + W would close the window but leave music running and the "mini player" active in the top OS menu bar. CMD + Q would kill everything.
Author
Owner

@jpochyla commented on GitHub (Aug 18, 2021):

This is slightly more difficult than it seems, because i.e. the audio output thread is stored in a PlaybackController widget that would get destroyed on closing the window. I suppose we should tackle this anyway, because "closing" the app to the Windows systray would also be a cool feature.

<!-- gh-comment-id:901142399 --> @jpochyla commented on GitHub (Aug 18, 2021): This is slightly more difficult than it seems, because i.e. the audio output thread is stored in a `PlaybackController` widget that would get destroyed on closing the window. I suppose we should tackle this anyway, because "closing" the app to the Windows systray would also be a cool feature.
Author
Owner

@JuliDi commented on GitHub (Aug 18, 2021):

Thanks for the clarification @jpochyla . I gave it a try and realized that closing the window also stops the music.

I have started looking into rust libraries that provide tray icon functionality but didn't yet find anything. Could the PlaybackController be held in the tray (if possible) to be more persistent and independent of the window?

<!-- gh-comment-id:901145511 --> @JuliDi commented on GitHub (Aug 18, 2021): Thanks for the clarification @jpochyla . I gave it a try and realized that closing the window also stops the music. I have started looking into rust libraries that provide tray icon functionality but didn't yet find anything. Could the `PlaybackController` be held in the tray (if possible) to be more persistent and independent of the window?
Author
Owner

@peterkos commented on GitHub (Feb 18, 2024):

This should also occur for any windows in the app, like the Settings window. I'm not sure if Windows has a similar convention, but I wanted to note that #443 with Esc would still need Cmd+W on macOS to be consistent w/ macOS conventions :)

Interestingly, Cmd+` to cycle focus between Psst's windows does work between Settings and the main app window 🚀

<!-- gh-comment-id:1951462272 --> @peterkos commented on GitHub (Feb 18, 2024): This should also occur for any windows in the app, like the Settings window. I'm not sure if Windows has a similar convention, but I wanted to note that #443 with `Esc` would still need `Cmd+W` on macOS to be consistent w/ macOS conventions :) Interestingly, <code>Cmd+`</code> to cycle focus between Psst's windows _does_ work between Settings and the main app window 🚀
Author
Owner

@jacksongoode commented on GitHub (Jul 8, 2024):

Reviving this a bit as it would be a super nice feature with potentially minimal effort with the right package. Just looking around for cross-platform tray managers https://github.com/olback/tray-item-rs and https://github.com/tauri-apps/tray-icon seem somewhat maintained and cross platform (at least to gtk on Linux).

Does anyone have any additional thoughts on this?

<!-- gh-comment-id:2213081142 --> @jacksongoode commented on GitHub (Jul 8, 2024): Reviving this a bit as it would be a super nice feature with potentially minimal effort with the right package. Just looking around for cross-platform tray managers https://github.com/olback/tray-item-rs and https://github.com/tauri-apps/tray-icon seem somewhat maintained and cross platform (at least to gtk on Linux). Does anyone have any additional thoughts on this?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/psst#76
No description provided.