diff --git a/Settings.ui b/Settings.ui
index 1b12929..62be3ff 100644
--- a/Settings.ui
+++ b/Settings.ui
@@ -1140,6 +1140,90 @@
1
+
+
+
+ False
+ True
+ 2
+
+
Advanced Options
@@ -1151,7 +1235,7 @@
False
True
- 2
+ 3
diff --git a/overview.js b/overview.js
index 3f48f73..752ae14 100644
--- a/overview.js
+++ b/overview.js
@@ -26,9 +26,13 @@ const Lang = imports.lang;
const Main = imports.ui.main;
const Shell = imports.gi.Shell;
+const Meta = imports.gi.Meta;
+
const dtpOverview = new Lang.Class({
Name: 'DashToPanel.Overview',
+ _numHotkeys: 10,
+
_init: function(settings) {
this._dtpSettings = settings;
},
@@ -51,6 +55,7 @@ const dtpOverview = new Lang.Class({
Main.overview._controls.dash.actor.set_width(1);
this._optionalWorkspaceIsolation();
+ this._optionalHotKeys();
this._bindSettingsChanges();
},
@@ -62,6 +67,9 @@ const dtpOverview = new Lang.Class({
// reset stored icon size to the default dash
Main.overview.dashIconSize = Main.overview._controls.dash.iconSize;
+
+ // Remove key bindings
+ this._disableHotKeys();
},
_bindSettingsChanges: function() {
@@ -129,5 +137,74 @@ const dtpOverview = new Lang.Class({
return Main.activateWindow(windows[0]);
return this.open_new_window(-1);
}
- }
-});
\ No newline at end of file
+ },
+
+ // Hotkeys
+ _activateApp: function(appIndex) {
+ let children = this.taskbar._box.get_children().filter(function(actor) {
+ return actor.child &&
+ actor.child._delegate &&
+ actor.child._delegate.app;
+ });
+
+ // Apps currently in the taskbar
+ let apps = children.map(function(actor) {
+ return actor.child._delegate;
+ });
+
+ // Activate with button = 1, i.e. same as left click
+ let button = 1;
+ if (appIndex < apps.length)
+ apps[appIndex].activate(button);
+ },
+
+ _optionalHotKeys: function() {
+ this._hotKeysEnabled = false;
+ if (this._dtpSettings.get_boolean('hot-keys'))
+ this._enableHotKeys();
+
+ this._signalsHandler.add([
+ this._dtpSettings,
+ 'changed::hot-keys',
+ Lang.bind(this, function() {
+ if (this._dtpSettings.get_boolean('hot-keys'))
+ Lang.bind(this, this._enableHotKeys)();
+ else
+ Lang.bind(this, this._disableHotKeys)();
+ })
+ ]);
+ },
+ _enableHotKeys: function() {
+ if (this._hotKeysEnabled)
+ return;
+
+ // Setup keyboard bindings for taskbar elements
+ let keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-', // Regular numbers
+ 'app-hotkey-kp-', 'app-shift-hotkey-kp-', 'app-ctrl-hotkey-kp-']; // Key-pad numbers
+ keys.forEach( function(key) {
+ for (let i = 0; i < this._numHotkeys; i++) {
+ let appNum = i;
+ Main.wm.addKeybinding(key + (i + 1), this._dtpSettings,
+ Meta.KeyBindingFlags.NONE,
+ Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
+ Lang.bind(this, function() {this._activateApp(appNum);}));
+ }
+ }, this);
+
+ this._hotKeysEnabled = true;
+ },
+
+ _disableHotKeys: function() {
+ if (!this._hotKeysEnabled)
+ return;
+
+ let keys = ['app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-', // Regular numbers
+ 'app-hotkey-kp-', 'app-shift-hotkey-kp-', 'app-ctrl-hotkey-kp-']; // Key-pad numbers
+ keys.forEach( function(key) {
+ for (let i = 0; i < this._numHotkeys; i++)
+ Main.wm.removeKeybinding(key + (i + 1));
+ }, this);
+
+ this._hotKeysEnabled = false;
+ }
+});
diff --git a/prefs.js b/prefs.js
index 7986701..230d816 100644
--- a/prefs.js
+++ b/prefs.js
@@ -232,6 +232,11 @@ const Settings = new Lang.Class({
}));
+ this._settings.bind('hot-keys',
+ this._builder.get_object('hot_keys_switch'),
+ 'active',
+ Gio.SettingsBindFlags.DEFAULT);
+
// setup dialog for advanced options
this._builder.get_object('button_advanced_options').connect('clicked', Lang.bind(this, function() {
diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
index bfd42db..5290c55 100644
--- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
@@ -142,5 +142,430 @@
Status icon padding
Set the size of the aggregate (status) menu icon padding. (-1 for default)
+
+ false
+ Super Hot-Keys
+ Launch and switch between dash items using Super+(0-9)
+
+
+ 1']]]>
+ Keybinding to launch 1st dash app
+
+ Keybinding to launch 1st app.
+
+
+
+ 2']]]>
+ Keybinding to launch 2nd dash app
+
+ Keybinding to launch 2nd app.
+
+
+
+ 3']]]>
+ Keybinding to launch 3rd dash app
+
+ Keybinding to launch 3rd app.
+
+
+
+ 4']]]>
+ Keybinding to launch 4th dash app
+
+ Keybinding to launch 4th app.
+
+
+
+ 5']]]>
+ Keybinding to launch 5th dash app
+
+ Keybinding to launch 5th app.
+
+
+
+ 6']]]>
+ Keybinding to launch 6th dash app
+
+ Keybinding to launch 6th app.
+
+
+
+ 7']]]>
+ Keybinding to launch 7th dash app
+
+ Keybinding to launch 7th app.
+
+
+
+ 8']]]>
+ Keybinding to launch 8th dash app
+
+ Keybinding to launch 8th app.
+
+
+
+ 9']]]>
+ Keybinding to launch 9th dash app
+
+ Keybinding to launch 9th app.
+
+
+
+ 0']]]>
+ Keybinding to launch 10th dash app
+
+ Keybinding to launch 10th app.
+
+
+
+ 1']]]>
+ Keybinding to trigger 1st dash app with shift behavior
+
+ Keybinding to trigger 1st app with shift behavior.
+
+
+
+ 2']]]>
+ Keybinding to trigger 2nd dash app with shift behavior
+
+ Keybinding to trigger 2nd app with shift behavior.
+
+
+
+ 3']]]>
+ Keybinding to trigger 3rd dash app with shift behavior
+
+ Keybinding to trigger 3rd app with shift behavior.
+
+
+
+ 4']]]>
+ Keybinding to trigger 4th dash app with shift behavior
+
+ Keybinding to trigger 4th app with shift behavior.
+
+
+
+ 5']]]>
+ Keybinding to trigger 5th dash app with shift behavior
+
+ Keybinding to trigger 5th app with shift behavior.
+
+
+
+ 6']]]>
+ Keybinding to trigger 6th dash app with shift behavior
+
+ Keybinding to trigger 6th app with shift behavior.
+
+
+
+ 7']]]>
+ Keybinding to trigger 7th dash app with shift behavior
+
+ Keybinding to trigger 7th app with shift behavior.
+
+
+
+ 8']]]>
+ Keybinding to trigger 8th dash app with shift behavior
+
+ Keybinding to trigger 8th app with shift behavior.
+
+
+
+ 9']]]>
+ Keybinding to trigger 9th dash app with shift behavior
+
+ Keybinding to trigger 9th app with shift behavior.
+
+
+
+ 0']]]>
+ Keybinding to trigger 10th dash app with shift behavior
+
+ Keybinding to trigger 10th app with shift behavior.
+
+
+
+ 1']]]>
+ Keybinding to trigger 1st dash app
+
+ Keybinding to either show or launch the 1st application in the dash.
+
+
+
+ 2']]]>
+ Keybinding to trigger 2nd dash app
+
+ Keybinding to either show or launch the 2nd application in the dash.
+
+
+
+ 3']]]>
+ Keybinding to trigger 3rd dash app
+
+ Keybinding to either show or launch the 3rd application in the dash.
+
+
+
+ 4']]]>
+ Keybinding to trigger 4th dash app
+
+ Keybinding to either show or launch the 4th application in the dash.
+
+
+
+ 5']]]>
+ Keybinding to trigger 5th dash app
+
+ Keybinding to either show or launch the 5th application in the dash.
+
+
+
+ 6']]]>
+ Keybinding to trigger 6th dash app
+
+ Keybinding to either show or launch the 6th application in the dash.
+
+
+
+ 7']]]>
+ Keybinding to trigger 7th dash app
+
+ Keybinding to either show or launch the 7th application in the dash.
+
+
+
+ 8']]]>
+ Keybinding to trigger 8th dash app
+
+ Keybinding to either show or launch the 8th application in the dash.
+
+
+
+ 9']]]>
+ Keybinding to trigger 9th dash app
+
+ Keybinding to either show or launch the 9th application in the dash.
+
+
+
+ 0']]]>
+ Keybinding to trigger 10th dash app
+
+ Keybinding to either show or launch the 10th application in the dash.
+
+
+
+ KP_1']]]>
+ Keybinding to launch 1st dash app
+
+ Keybinding to launch 1st app.
+
+
+
+ KP_2']]]>
+ Keybinding to launch 2nd dash app
+
+ Keybinding to launch 2nd app.
+
+
+
+ KP_3']]]>
+ Keybinding to launch 3rd dash app
+
+ Keybinding to launch 3rd app.
+
+
+
+ KP_4']]]>
+ Keybinding to launch 4th dash app
+
+ Keybinding to launch 4th app.
+
+
+
+ KP_5']]]>
+ Keybinding to launch 5th dash app
+
+ Keybinding to launch 5th app.
+
+
+
+ KP_6']]]>
+ Keybinding to launch 6th dash app
+
+ Keybinding to launch 6th app.
+
+
+
+ KP_7']]]>
+ Keybinding to launch 7th dash app
+
+ Keybinding to launch 7th app.
+
+
+
+ KP_8']]]>
+ Keybinding to launch 8th dash app
+
+ Keybinding to launch 8th app.
+
+
+
+ KP_9']]]>
+ Keybinding to launch 9th dash app
+
+ Keybinding to launch 9th app.
+
+
+
+ KP_0']]]>
+ Keybinding to launch 10th dash app
+
+ Keybinding to launch 10th app.
+
+
+
+ KP_1']]]>
+ Keybinding to trigger 1st dash app with shift behavior
+
+ Keybinding to trigger 1st app with shift behavior.
+
+
+
+ KP_2']]]>
+ Keybinding to trigger 2nd dash app with shift behavior
+
+ Keybinding to trigger 2nd app with shift behavior.
+
+
+
+ KP_3']]]>
+ Keybinding to trigger 3rd dash app with shift behavior
+
+ Keybinding to trigger 3rd app with shift behavior.
+
+
+
+ KP_4']]]>
+ Keybinding to trigger 4th dash app with shift behavior
+
+ Keybinding to trigger 4th app with shift behavior.
+
+
+
+ KP_5']]]>
+ Keybinding to trigger 5th dash app with shift behavior
+
+ Keybinding to trigger 5th app with shift behavior.
+
+
+
+ KP_6']]]>
+ Keybinding to trigger 6th dash app with shift behavior
+
+ Keybinding to trigger 6th app with shift behavior.
+
+
+
+ KP_7']]]>
+ Keybinding to trigger 7th dash app with shift behavior
+
+ Keybinding to trigger 7th app with shift behavior.
+
+
+
+ KP_8']]]>
+ Keybinding to trigger 8th dash app with shift behavior
+
+ Keybinding to trigger 8th app with shift behavior.
+
+
+
+ KP_9']]]>
+ Keybinding to trigger 9th dash app with shift behavior
+
+ Keybinding to trigger 9th app with shift behavior.
+
+
+
+ KP_0']]]>
+ Keybinding to trigger 10th dash app with shift behavior
+
+ Keybinding to trigger 10th app with shift behavior.
+
+
+
+ KP_1']]]>
+ Keybinding to trigger 1st dash app
+
+ Keybinding to either show or launch the 1st application in the dash.
+
+
+
+ KP_2']]]>
+ Keybinding to trigger 2nd dash app
+
+ Keybinding to either show or launch the 2nd application in the dash.
+
+
+
+ KP_3']]]>
+ Keybinding to trigger 3rd dash app
+
+ Keybinding to either show or launch the 3rd application in the dash.
+
+
+
+ KP_4']]]>
+ Keybinding to trigger 4th dash app
+
+ Keybinding to either show or launch the 4th application in the dash.
+
+
+
+ KP_5']]]>
+ Keybinding to trigger 5th dash app
+
+ Keybinding to either show or launch the 5th application in the dash.
+
+
+
+ KP_6']]]>
+ Keybinding to trigger 6th dash app
+
+ Keybinding to either show or launch the 6th application in the dash.
+
+
+
+ KP_7']]]>
+ Keybinding to trigger 7th dash app
+
+ Keybinding to either show or launch the 7th application in the dash.
+
+
+
+ KP_8']]]>
+ Keybinding to trigger 8th dash app
+
+ Keybinding to either show or launch the 8th application in the dash.
+
+
+
+ KP_9']]]>
+ Keybinding to trigger 9th dash app
+
+ Keybinding to either show or launch the 9th application in the dash.
+
+
+
+ KP_0']]]>
+ Keybinding to trigger 10th dash app
+
+ Keybinding to either show or launch the 10th application in the dash.
+
+