mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-15 00:34:05 +09:00
Add number keys selection for the hotkeys
This commit is contained in:
65
Settings.ui
65
Settings.ui
@@ -3670,6 +3670,71 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_shortcut_num_keys">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_shortcut_num_keys">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="margin_right">12</property>
|
||||
<property name="margin_top">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="shortcut_num_keys_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<items>
|
||||
<item id="NUM_ROW" translatable="yes">Number row</item>
|
||||
<item id="NUM_KEYPAD" translatable="yes">Numeric keypad</item>
|
||||
<item id="BOTH" translatable="yes">Both</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="shortcut_num_keys_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Hotkeys are activated with</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="shortcut_num_keys_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Select which keyboard number keys are used to activate the hotkeys</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
23
overview.js
23
overview.js
@@ -230,6 +230,11 @@ var dtpOverview = Utils.defineClass({
|
||||
]);
|
||||
},
|
||||
|
||||
_resetHotkeys: function() {
|
||||
this._disableHotKeys();
|
||||
this._enableHotKeys();
|
||||
},
|
||||
|
||||
_enableHotKeys: function() {
|
||||
if (this._hotKeysEnabled)
|
||||
return;
|
||||
@@ -242,8 +247,18 @@ var dtpOverview = Utils.defineClass({
|
||||
}
|
||||
|
||||
// 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
|
||||
let shortcutNumKeys = Me.settings.get_string('shortcut-num-keys');
|
||||
let bothNumKeys = shortcutNumKeys == 'BOTH';
|
||||
let keys = [];
|
||||
|
||||
if (bothNumKeys || shortcutNumKeys == 'NUM_ROW') {
|
||||
keys.push('app-hotkey-', 'app-shift-hotkey-', 'app-ctrl-hotkey-'); // Regular numbers
|
||||
}
|
||||
|
||||
if (bothNumKeys || shortcutNumKeys == 'NUM_KEYPAD') {
|
||||
keys.push('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;
|
||||
@@ -301,6 +316,10 @@ var dtpOverview = Utils.defineClass({
|
||||
else
|
||||
this.taskbar.toggleNumberOverlay(false);
|
||||
})
|
||||
], [
|
||||
Me.settings,
|
||||
'changed::shortcut-num-keys',
|
||||
() => this._resetHotkeys()
|
||||
]);
|
||||
},
|
||||
|
||||
|
||||
7
prefs.js
7
prefs.js
@@ -1501,7 +1501,12 @@ const Settings = new Lang.Class({
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.connect('changed::hotkey-prefix-text', Lang.bind(this, function() {checkHotkeyPrefix(this._settings);}));
|
||||
this._builder.get_object('shortcut_num_keys_combo').set_active_id(this._settings.get_string('shortcut-num-keys'));
|
||||
this._builder.get_object('shortcut_num_keys_combo').connect('changed', Lang.bind (this, function(widget) {
|
||||
this._settings.set_string('shortcut-num-keys', widget.get_active_id());
|
||||
}));
|
||||
|
||||
this._settings.connect('changed::hotkey-prefix-text', Lang.bind(this, function() {checkHotkeyPrefix(this._settings);}));
|
||||
|
||||
this._builder.get_object('hotkey_prefix_combo').set_active_id(this._settings.get_string('hotkey-prefix-text'));
|
||||
|
||||
|
||||
@@ -65,6 +65,11 @@
|
||||
<value value='3' nick='bold'/>
|
||||
<value value='4' nick='bolder'/>
|
||||
</enum>
|
||||
<enum id='org.gnome.shell.extensions.dash-to-panel.hotkeyNumberKeys'>
|
||||
<value value='0' nick='NUM_ROW'/>
|
||||
<value value='1' nick='NUM_KEYPAD'/>
|
||||
<value value='2' nick='BOTH'/>
|
||||
</enum>
|
||||
<schema path="/org/gnome/shell/extensions/dash-to-panel/" id="org.gnome.shell.extensions.dash-to-panel">
|
||||
<key name="panel-position" enum="org.gnome.shell.extensions.dash-to-panel.position">
|
||||
<default>'BOTTOM'</default>
|
||||
@@ -725,6 +730,11 @@
|
||||
<summary>Show window previews</summary>
|
||||
<description>When multiple instances of the application are available, show their window previews</description>
|
||||
</key>
|
||||
<key name="shortcut-num-keys" enum="org.gnome.shell.extensions.dash-to-panel.hotkeyNumberKeys">
|
||||
<default>'BOTH'</default>
|
||||
<summary>Hotkeys number keys</summary>
|
||||
<description>Which number keys are used for the hotkeys</description>
|
||||
</key>
|
||||
<key name="app-ctrl-hotkey-1" type="as">
|
||||
<default><![CDATA[['<Ctrl><Super>1']]]></default>
|
||||
<summary>Keybinding to launch 1st dash app</summary>
|
||||
|
||||
Reference in New Issue
Block a user