[gnome-shell/wip/fmuellner/fav-shortcuts: 58/58] windowManager: Add switch-to-application-n keybindings
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/fav-shortcuts: 58/58] windowManager: Add switch-to-application-n keybindings
- Date: Tue, 5 Feb 2019 11:33:47 +0000 (UTC)
commit 4590094605774dab4c76d67953cf032616dee089
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jan 29 11:48:06 2019 +0100
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
data/org.gnome.shell.gschema.xml.in | 36 +++++++++++++++++++
js/ui/windowManager.js | 72 +++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+)
---
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index 87898a36e..24e2a75b0 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -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/"
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 2cb8dfb31..8450cfd33 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -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();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]