windowManager: Add switch-to-application-n keybindings
Having Unity-like shortcuts for activating the first nine applications in the dash has been a long requested feature, but somehow nobody got around to implement it. As the shortcut is most useful outside the overview where the dash is not visible, only consider favorite apps as they have a predictable order. https://bugzilla.gnome.org/show_bug.cgi?id=648000
This commit is contained in:
parent
15e7625c80
commit
4590094605
@ -145,6 +145,42 @@
|
||||
<summary>Keybinding that pauses and resumes all running tweens, for debugging purposes</summary>
|
||||
<description></description>
|
||||
</key>
|
||||
<key name="switch-to-application-1" type="as">
|
||||
<default>["<Super>1"]</default>
|
||||
<summary>Switch to application 1</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-2" type="as">
|
||||
<default>["<Super>2"]</default>
|
||||
<summary>Switch to application 2</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-3" type="as">
|
||||
<default>["<Super>3"]</default>
|
||||
<summary>Switch to application 3</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-4" type="as">
|
||||
<default>["<Super>4"]</default>
|
||||
<summary>Switch to application 4</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-5" type="as">
|
||||
<default>["<Super>5"]</default>
|
||||
<summary>Switch to application 5</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-6" type="as">
|
||||
<default>["<Super>6"]</default>
|
||||
<summary>Switch to application 6</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-7" type="as">
|
||||
<default>["<Super>7"]</default>
|
||||
<summary>Switch to application 7</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-8" type="as">
|
||||
<default>["<Super>8"]</default>
|
||||
<summary>Switch to application 8</summary>
|
||||
</key>
|
||||
<key name="switch-to-application-9" type="as">
|
||||
<default>["<Super>9"]</default>
|
||||
<summary>Switch to application 9</summary>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
<schema id="org.gnome.shell.keyboard" path="/org/gnome/shell/keyboard/"
|
||||
|
@ -12,6 +12,7 @@ const Shell = imports.gi.Shell;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const AltTab = imports.ui.altTab;
|
||||
const AppFavorites = imports.ui.appFavorites;
|
||||
const Dialog = imports.ui.dialog;
|
||||
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
|
||||
const InhibitShortcutsDialog = imports.ui.inhibitShortcutsDialog;
|
||||
@ -938,6 +939,69 @@ var WindowManager = class {
|
||||
Shell.ActionMode.POPUP,
|
||||
this._toggleCalendar.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-1',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-2',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-3',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-4',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-5',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-6',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-7',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-8',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
this.addKeybinding('switch-to-application-9',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||
Shell.ActionMode.NORMAL |
|
||||
Shell.ActionMode.OVERVIEW,
|
||||
this._switchToApplication.bind(this));
|
||||
|
||||
global.display.connect('show-resize-popup', this._showResizePopup.bind(this));
|
||||
global.display.connect('show-pad-osd', this._showPadOsd.bind(this));
|
||||
global.display.connect('show-osd', (display, monitorIndex, iconName, label) => {
|
||||
@ -2012,6 +2076,14 @@ var WindowManager = class {
|
||||
Main.ctrlAltTabManager.popup(binding.is_reversed(), binding.get_name(), binding.get_mask());
|
||||
}
|
||||
|
||||
_switchToApplication(display, window, binding) {
|
||||
let [,,,target] = binding.get_name().split('-');
|
||||
let apps = AppFavorites.getAppFavorites().getFavorites();
|
||||
let app = apps[target - 1];
|
||||
if (app)
|
||||
app.activate();
|
||||
}
|
||||
|
||||
_toggleAppMenu(display, window, event, binding) {
|
||||
Main.panel.toggleAppMenu();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user