orontee / argos

Light weight front-end for Mopidy music server
GNU General Public License v3.0
19 stars 4 forks source link

Enable a ctrl-w shortcut to close the top window #154

Closed hufman closed 6 months ago

hufman commented 6 months ago

My fingers default to ctrl-w to close tabs and windows, so this attempts to add a ctrl-w accel. Since it's handled at the app layer instead of a specific window, it closes the preferences window if it's open, even if the user has focused the main window, but that's probably fine? And the shortcuts dialog doesn't work with ctrl-q or ctrl-w at all, just the escape key.

orontee commented 6 months ago

Thanks for your contribution @hufman !

I agree that current shortcuts are incomplete and not coherent. Especially, Ctrl+W should close the main window.

Since it's handled at the app layer instead of a specific window, it closes the preferences window if it's open,

I'd rather stay coherent with what I see in other Gnome applications:

Since Argos has only one window, both Ctrl+W and Ctrl+Q shortcuts behavior should be the same, everywhere.

Especially Ctrl+W should not close the preferences window, Ctrl+Q should not quit the application when the preferences window is opened or when the play stream dialog is opened, etc.

@hufman Do you think it's feasible to modify your proposal to have this behavior?

orontee commented 6 months ago

Note for myself: Implies a translations update.

hufman commented 6 months ago

I agree with wanting to be consistent with what other apps are doing, yes. However, I experience Argos as having three windows: window.ui is the main screen, preferences.ui, and help_overlay.ui. I think Ctrl+W should close the preferences window if it's open, since it's the standard shortcut to close the focused window. Ctrl+Q should close the application, no matter what windows are open, and I think it's a bug that the shortcuts window blocks this.

Unfortunately, I am unfamiliar with GTK programming, and this is the best I could come up with. I wish I knew how to determine which window is focused, so that the Ctrl+W shortcut closed the correct window. From my reading, it sounds like the windows would all need menu entries with accelerator shortcuts, or to each implement a key hook function.

orontee commented 6 months ago

Don't worry I'll investigate the implementation details once we agree on a target.

hufman commented 6 months ago

I see this feature was added, thank you!

orontee commented 6 months ago

I see this feature was added, thank you!

I am sorry, I failed to find a way to have reconfigurable key bindings. Looks like it's not straightforward in Python with Gtk3 (details in #155 ).

So the merged code is not exactly what you expect... The first goal was to have coherent keybindings.

hufman commented 6 months ago

I don't mind the lack of configuration, just having the Ctrl+W is enough :) I tested the new version and it feels right to me.