windowManager: Use generic filter mechanism for all keybindings
With the new flexible system in place, there's no point explicitly hardcoding some built-in keybindings; just use the generic mechanism for everything. https://bugzilla.gnome.org/show_bug.cgi?id=688202
This commit is contained in:
parent
0d9f70492e
commit
76d776245b
@ -83,7 +83,17 @@ let _overridesSettings = null;
|
|||||||
let background = null;
|
let background = null;
|
||||||
|
|
||||||
function _sessionUpdated() {
|
function _sessionUpdated() {
|
||||||
Meta.keybindings_set_custom_handler('panel-run-dialog', sessionMode.hasRunDialog ? openRunDialog : null);
|
wm.setCustomKeybindingHandler('panel-main-menu',
|
||||||
|
KeybindingMode.NORMAL |
|
||||||
|
KeybindingMode.OVERVIEW,
|
||||||
|
sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null);
|
||||||
|
wm.allowKeybinding('overlay-key', KeybindingMode.NORMAL |
|
||||||
|
KeybindingMode.OVERVIEW);
|
||||||
|
|
||||||
|
wm.setCustomKeybindingHandler('panel-run-dialog',
|
||||||
|
KeybindingMode.NORMAL |
|
||||||
|
KeybindingMode.OVERVIEW,
|
||||||
|
sessionMode.hasRunDialog ? openRunDialog : null);
|
||||||
if (sessionMode.isGreeter)
|
if (sessionMode.isGreeter)
|
||||||
screenShield.showDialog();
|
screenShield.showDialog();
|
||||||
}
|
}
|
||||||
@ -169,9 +179,7 @@ function start() {
|
|||||||
|
|
||||||
global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT,
|
global.screen.override_workspace_layout(Meta.ScreenCorner.TOPLEFT,
|
||||||
false, -1, 1);
|
false, -1, 1);
|
||||||
Meta.keybindings_set_custom_handler('panel-main-menu', Lang.bind(overview, overview.toggle));
|
|
||||||
global.display.connect('overlay-key', Lang.bind(overview, overview.toggle));
|
global.display.connect('overlay-key', Lang.bind(overview, overview.toggle));
|
||||||
|
|
||||||
sessionMode.connect('update', _sessionUpdated);
|
sessionMode.connect('update', _sessionUpdated);
|
||||||
_sessionUpdated();
|
_sessionUpdated();
|
||||||
|
|
||||||
|
@ -104,36 +104,63 @@ const WindowManager = new Lang.Class({
|
|||||||
this._shellwm.connect('filter-keybinding', Lang.bind(this, this._filterKeybinding));
|
this._shellwm.connect('filter-keybinding', Lang.bind(this, this._filterKeybinding));
|
||||||
|
|
||||||
this._workspaceSwitcherPopup = null;
|
this._workspaceSwitcherPopup = null;
|
||||||
Meta.keybindings_set_custom_handler('switch-to-workspace-left',
|
this.setCustomKeybindingHandler('switch-to-workspace-left',
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
Meta.keybindings_set_custom_handler('switch-to-workspace-right',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.keybindings_set_custom_handler('switch-to-workspace-up',
|
this.setCustomKeybindingHandler('switch-to-workspace-right',
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
Meta.keybindings_set_custom_handler('switch-to-workspace-down',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.keybindings_set_custom_handler('move-to-workspace-left',
|
this.setCustomKeybindingHandler('switch-to-workspace-up',
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
Meta.keybindings_set_custom_handler('move-to-workspace-right',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.keybindings_set_custom_handler('move-to-workspace-up',
|
this.setCustomKeybindingHandler('switch-to-workspace-down',
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
Meta.keybindings_set_custom_handler('move-to-workspace-down',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._showWorkspaceSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.keybindings_set_custom_handler('switch-windows',
|
this.setCustomKeybindingHandler('move-to-workspace-left',
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
Meta.keybindings_set_custom_handler('switch-group',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.keybindings_set_custom_handler('switch-windows-backward',
|
this.setCustomKeybindingHandler('move-to-workspace-right',
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
Meta.keybindings_set_custom_handler('switch-group-backward',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
Lang.bind(this, this._startAppSwitcher));
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.keybindings_set_custom_handler('switch-panels',
|
this.setCustomKeybindingHandler('move-to-workspace-up',
|
||||||
Lang.bind(this, this._startA11ySwitcher));
|
Main.KeybindingMode.NORMAL |
|
||||||
global.display.add_keybinding('open-application-menu',
|
Main.KeybindingMode.OVERVIEW,
|
||||||
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
Meta.KeyBindingFlags.NONE,
|
this.setCustomKeybindingHandler('move-to-workspace-down',
|
||||||
Lang.bind(this, this._openAppMenu));
|
Main.KeybindingMode.NORMAL |
|
||||||
|
Main.KeybindingMode.OVERVIEW,
|
||||||
|
Lang.bind(this, this._showWorkspaceSwitcher));
|
||||||
|
this.setCustomKeybindingHandler('switch-windows',
|
||||||
|
Main.KeybindingMode.NORMAL,
|
||||||
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
|
this.setCustomKeybindingHandler('switch-group',
|
||||||
|
Main.KeybindingMode.NORMAL,
|
||||||
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
|
this.setCustomKeybindingHandler('switch-windows-backward',
|
||||||
|
Main.KeybindingMode.NORMAL,
|
||||||
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
|
this.setCustomKeybindingHandler('switch-group-backward',
|
||||||
|
Main.KeybindingMode.NORMAL,
|
||||||
|
Lang.bind(this, this._startAppSwitcher));
|
||||||
|
this.setCustomKeybindingHandler('switch-panels',
|
||||||
|
Main.KeybindingMode.NORMAL |
|
||||||
|
Main.KeybindingMode.OVERVIEW |
|
||||||
|
Main.KeybindingMode.LOCK_SCREEN |
|
||||||
|
Main.KeybindingMode.UNLOCK_SCREEN |
|
||||||
|
Main.KeybindingMode.LOGIN_SCREEN,
|
||||||
|
Lang.bind(this, this._startA11ySwitcher));
|
||||||
|
|
||||||
|
this.addKeybinding('open-application-menu',
|
||||||
|
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
|
||||||
|
Meta.KeyBindingFlags.NONE,
|
||||||
|
Main.KeybindingMode.NORMAL,
|
||||||
|
Lang.bind(this, this._openAppMenu));
|
||||||
|
|
||||||
Main.overview.connect('showing', Lang.bind(this, function() {
|
Main.overview.connect('showing', Lang.bind(this, function() {
|
||||||
for (let i = 0; i < this._dimmedWindows.length; i++)
|
for (let i = 0; i < this._dimmedWindows.length; i++)
|
||||||
@ -451,24 +478,6 @@ const WindowManager = new Lang.Class({
|
|||||||
if (Main.modalCount > (Main.overview.visible ? 1 : 0))
|
if (Main.modalCount > (Main.overview.visible ? 1 : 0))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let action = Meta.prefs_get_keybinding_action(binding.get_name());
|
|
||||||
switch (action) {
|
|
||||||
// left/right would effectively act as synonyms for up/down if we enabled them;
|
|
||||||
// but that could be considered confusing; we also disable them in the main view.
|
|
||||||
//
|
|
||||||
// case Meta.KeyBindingAction.WORKSPACE_LEFT:
|
|
||||||
// case Meta.KeyBindingAction.WORKSPACE_RIGHT:
|
|
||||||
case Meta.KeyBindingAction.WORKSPACE_UP:
|
|
||||||
case Meta.KeyBindingAction.WORKSPACE_DOWN:
|
|
||||||
return !Main.sessionMode.hasWorkspaces;
|
|
||||||
|
|
||||||
case Meta.KeyBindingAction.PANEL_RUN_DIALOG:
|
|
||||||
case Meta.KeyBindingAction.COMMAND_2:
|
|
||||||
case Meta.KeyBindingAction.PANEL_MAIN_MENU:
|
|
||||||
case Meta.KeyBindingAction.OVERLAY_KEY:
|
|
||||||
case Meta.KeyBindingAction.SWITCH_PANELS:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There's little sense in implementing a keybinding in mutter and
|
// There's little sense in implementing a keybinding in mutter and
|
||||||
// not having it work in NORMAL mode; handle this case generically
|
// not having it work in NORMAL mode; handle this case generically
|
||||||
|
Loading…
Reference in New Issue
Block a user