Hotkeys prefix: limit to either Super or SuperAlt

This commit is contained in:
franglais125
2017-02-15 15:50:59 -05:00
parent 015e9c247f
commit 99320ca586
4 changed files with 29 additions and 8 deletions

View File

@@ -48,13 +48,19 @@
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkEntry" id="hotkey_prefix_entry">
<property name="width-chars">12</property>
<object class="GtkComboBoxText" id="hotkey_prefix_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item id="Super" translatable="yes">Super</item>
<item id="SuperAlt" translatable="yes">Super + Alt</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
<child>
@@ -76,7 +82,7 @@
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="max-width-chars">40</property>
<property name="label" translatable="yes">Syntax: &lt;Shift&gt;, &lt;Ctrl&gt;, &lt;Alt&gt;, &lt;Super&gt;</property>
<property name="label" translatable="yes">Hotkeys will either be Super+Number or Super+Alt+Num</property>
<property name="wrap">True</property>
<style>
<class name="dim-label"/>

View File

@@ -186,6 +186,10 @@ const dtpOverview = new Lang.Class({
_checkHotkeyPrefix: function() {
let hotkeyPrefix = this._dtpSettings.get_string('hotkey-prefix-text');
if (hotkeyPrefix == 'Super')
hotkeyPrefix = '<Super>';
else if (hotkeyPrefix == 'SuperAlt')
hotkeyPrefix = '<Super><Alt>';
let [key, mods] = Gtk.accelerator_parse(hotkeyPrefix);
for (let i = 1; i <= this._numHotkeys; i++) {

View File

@@ -273,10 +273,17 @@ const Settings = new Lang.Class({
this._builder.get_object('overlay_switch').set_active(this._settings.get_boolean('hotkeys-overlay'));
this._settings.bind('hotkey-prefix-text',
this._builder.get_object('hotkey_prefix_entry'),
this._builder.get_object('hotkey_prefix_combo'),
'text',
Gio.SettingsBindFlags.DEFAULT);
this._builder.get_object('hotkey_prefix_combo').set_active_id(this._settings.get_string('hotkey-prefix-text'));
this._settings.bind('hotkey-prefix-text',
this._builder.get_object('hotkey_prefix_combo'),
'active-id',
Gio.SettingsBindFlags.DEFAULT);
this._settings.bind('hotkeys-overlay',
this._builder.get_object('overlay_switch'),
'active',

View File

@@ -13,6 +13,10 @@
<value value='1' nick='STATUSLEFT'/>
<value value='2' nick='STATUSRIGHT'/>
</enum>
<enum id='org.gnome.shell.extensions.dash-to-panel.hotkeyPrefix'>
<value value='0' nick='Super'/>
<value value='1' nick='SuperAlt'/>
</enum>
<!-- this is mean to Match StSide. LEFT and RIGHT actual position in reversed in
rtl languages -->
<enum id='org.gnome.shell.extensions.dash-to-panel.panelPosition'>
@@ -177,10 +181,10 @@
<summary>Super Hot-Keys</summary>
<description>Launch and switch between dash items using Super+(0-9)</description>
</key>
<key type="s" name="hotkey-prefix-text">
<default>"&lt;Super&gt;"</default>
<summary>Keybinding to show the dock and the number overlay.</summary>
<description>Behavior depends on hotkeys-show-dock and hotkeys-overlay.</description>
<key name="hotkey-prefix-text" enum="org.gnome.shell.extensions.dash-to-panel.hotkeyPrefix">
<default>'Super'</default>
<summary>Prefix to use for hotkeys</summary>
<description>You can choose between Super or SuperAlt as the prefix for hotkeys.</description>
</key>
<key name="app-ctrl-hotkey-1" type="as">
<default><![CDATA[['<Ctrl><Super>1']]]></default>