windowManager: Disable favorite shortcuts without overview

The `switch-to-application-n` shortcuts are essentially "launch the nth
app in the dash" actions, so they are at the very least confusing when
the dash isn't available because the overview itself is disabled (for
example in initial-setup mode).

So disable the shortcuts when the overview is disabled, but delegate the
decision to a separate function so that extensions like 'panel-favorites'
which expose favorites by some other means can easily re-enable them.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1333
This commit is contained in:
Florian Müllner 2019-05-29 17:20:23 +02:00 committed by Florian Müllner
parent 2b3ab3ecec
commit 866629b3d3

View File

@ -2121,7 +2121,14 @@ var WindowManager = class {
Main.ctrlAltTabManager.popup(binding.is_reversed(), binding.get_name(), binding.get_mask()); Main.ctrlAltTabManager.popup(binding.is_reversed(), binding.get_name(), binding.get_mask());
} }
_allowFavoriteShortcuts() {
return Main.sessionMode.hasOverview;
}
_switchToApplication(display, window, binding) { _switchToApplication(display, window, binding) {
if (!this._allowFavoriteShortcuts())
return;
let [,,,target] = binding.get_name().split('-'); let [,,,target] = binding.get_name().split('-');
let apps = AppFavorites.getAppFavorites().getFavorites(); let apps = AppFavorites.getAppFavorites().getFavorites();
let app = apps[target - 1]; let app = apps[target - 1];