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

CMD+W doesn't close the window on MacOS #103

Open
charlie-collard opened this issue Aug 17, 2021 · 9 comments
Open

CMD+W doesn't close the window on MacOS #103

charlie-collard opened this issue Aug 17, 2021 · 9 comments
Labels
bug Something isn't working macos MacOS-specific issues
Milestone

Comments

@charlie-collard
Copy link

charlie-collard commented Aug 17, 2021

Shows this in the console:

2021-08-17 19:46:44.745 psst-gui[50871:1024983] +[DruidView doCommandBySelector:]: unrecognized selector sent to class 0x7f7f3e56b220
@Kethku
Copy link
Contributor

Kethku commented 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.

@Stooovie
Copy link

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.

@Kethku
Copy link
Contributor

Kethku commented 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

@jpochyla jpochyla added bug Something isn't working macos MacOS-specific issues labels Aug 18, 2021
@JuliDi
Copy link
Contributor

JuliDi commented 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

// TODO:
// This is just overriding `platform_menus::mac::application::quit()`
// because l10n is a bit stupid now.

@henrymoulton
Copy link

henrymoulton commented 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.

@jpochyla
Copy link
Owner

jpochyla commented 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.

@JuliDi
Copy link
Contributor

JuliDi commented 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?

@jpochyla jpochyla added this to the First beta release milestone Dec 24, 2021
@peterkos
Copy link

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 🚀

@jacksongoode
Copy link
Collaborator

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos MacOS-specific issues
Projects
None yet
Development

No branches or pull requests

8 participants