mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Number overlay improvements:
* 1) Use milliseconds in settings * 2) Hotkeys-overlay boolean toggles overlay for app activation only * 3), 5) and 6) Decouple the timeouts for the overlay triggered by hotkeys or shortcut. Make the timeout configuration "sensitive", and remove show-dock references.
This commit is contained in:
99
Settings.ui
99
Settings.ui
@@ -9,9 +9,9 @@
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="shortcut_time_adjustment">
|
||||
<property name="upper">10</property>
|
||||
<property name="step_increment">0.250000000000000003</property>
|
||||
<property name="page_increment">1</property>
|
||||
<property name="upper">10000</property>
|
||||
<property name="step_increment">250</property>
|
||||
<property name="page_increment">1000</property>
|
||||
</object>
|
||||
<object class="GtkBox" id="box_overlay_shortcut">
|
||||
<property name="visible">True</property>
|
||||
@@ -78,7 +78,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Temporarily show the application numbers over the icons, corresponding to the shortcut.</property>
|
||||
<property name="label" translatable="yes">Temporarily show the application numbers over the icons when using the hotkeys.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<style>
|
||||
@@ -94,6 +94,50 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_timeout">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_timeout">
|
||||
<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="hexpand">True</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="timeout_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="adjustment">shortcut_time_adjustment</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="shortcut_timeout_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Hide timeout (ms)</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_extra_shortcut">
|
||||
<property name="width_request">100</property>
|
||||
@@ -125,7 +169,7 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Shortcut for the options above</property>
|
||||
<property name="label" translatable="yes">Shortcut to show the overlay for 2 seconds</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
@@ -153,51 +197,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_timeout">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_timeout">
|
||||
<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="hexpand">True</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="timeout_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="adjustment">shortcut_time_adjustment</property>
|
||||
<property name="digits">3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="shortcut_timeout_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Hide timeout (s)</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item">
|
||||
|
||||
22
overview.js
22
overview.js
@@ -218,8 +218,7 @@ const dtpOverview = new Lang.Class({
|
||||
_optionalNumberOverlay: function() {
|
||||
this._shortcutIsSet = false;
|
||||
// Enable extra shortcut
|
||||
if (this._dtpSettings.get_boolean('hot-keys') &&
|
||||
this._dtpSettings.get_boolean('hotkeys-overlay'))
|
||||
if (this._dtpSettings.get_boolean('hot-keys'))
|
||||
this._enableExtraShortcut();
|
||||
|
||||
this._signalsHandler.add([
|
||||
@@ -233,13 +232,12 @@ const dtpOverview = new Lang.Class({
|
||||
], [
|
||||
this._dtpSettings,
|
||||
'changed::shortcut-text',
|
||||
Lang.bind(this, this._setShortcut)
|
||||
Lang.bind(this, this._checkHotkeysOptions)
|
||||
]);
|
||||
},
|
||||
|
||||
_checkHotkeysOptions: function() {
|
||||
if (this._dtpSettings.get_boolean('hot-keys') &&
|
||||
this._dtpSettings.get_boolean('hotkeys-overlay'))
|
||||
if (this._dtpSettings.get_boolean('hot-keys'))
|
||||
this._enableExtraShortcut();
|
||||
else
|
||||
this._disableExtraShortcut();
|
||||
@@ -252,7 +250,10 @@ const dtpOverview = new Lang.Class({
|
||||
Main.wm.addKeybinding('shortcut', this._dtpSettings,
|
||||
Meta.KeyBindingFlags.NONE,
|
||||
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||
Lang.bind(this, this._showOverlay));
|
||||
Lang.bind(this, function() {
|
||||
this._overlayFromShortcut = true;
|
||||
this._showOverlay();
|
||||
}));
|
||||
this._shortcutIsSet = true;
|
||||
}
|
||||
},
|
||||
@@ -280,7 +281,7 @@ const dtpOverview = new Lang.Class({
|
||||
},
|
||||
|
||||
_showOverlay: function() {
|
||||
if (this._dtpSettings.get_boolean('hotkeys-overlay'))
|
||||
if (this._dtpSettings.get_boolean('hotkeys-overlay') || this._overlayFromShortcut)
|
||||
this.taskbar.toggleNumberOverlay(true);
|
||||
|
||||
// Restart the counting if the shortcut is pressed again
|
||||
@@ -289,8 +290,13 @@ const dtpOverview = new Lang.Class({
|
||||
this._numberOverlayTimeoutId = 0;
|
||||
}
|
||||
|
||||
let timeout = this._dtpSettings.get_int('overlay-timeout');
|
||||
if (this._overlayFromShortcut) {
|
||||
timeout = this._dtpSettings.get_int('shortcut-timeout');
|
||||
this._overlayFromShortcut = false;
|
||||
}
|
||||
|
||||
// Hide the overlay/dock after the timeout
|
||||
let timeout = this._dtpSettings.get_double('shortcut-timeout') * 1000;
|
||||
this._numberOverlayTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, function() {
|
||||
this._numberOverlayTimeoutId = 0;
|
||||
this.taskbar.toggleNumberOverlay(false);
|
||||
|
||||
19
prefs.js
19
prefs.js
@@ -258,7 +258,7 @@ const Settings = new Lang.Class({
|
||||
// Create dialog for number overlay options
|
||||
this._builder.get_object('overlay_button').connect('clicked', Lang.bind(this, function() {
|
||||
|
||||
let dialog = new Gtk.Dialog({ title: _('Show dock and application numbers'),
|
||||
let dialog = new Gtk.Dialog({ title: _('Application numbers'),
|
||||
transient_for: this.widget.get_toplevel(),
|
||||
use_header_bar: true,
|
||||
modal: true });
|
||||
@@ -272,23 +272,28 @@ const Settings = new Lang.Class({
|
||||
|
||||
this._builder.get_object('overlay_switch').set_active(this._settings.get_boolean('hotkeys-overlay'));
|
||||
|
||||
this._settings.bind('shortcut-text',
|
||||
this._builder.get_object('shortcut_entry'),
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('hotkeys-overlay',
|
||||
this._builder.get_object('overlay_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('shortcut-timeout',
|
||||
this._settings.bind('overlay-timeout',
|
||||
this._builder.get_object('timeout_spinbutton'),
|
||||
'value',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('hotkeys-overlay',
|
||||
this._builder.get_object('timeout_spinbutton'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._settings.bind('shortcut-text',
|
||||
this._builder.get_object('shortcut_entry'),
|
||||
'text',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
dialog.connect('response', Lang.bind(this, function(dialog, id) {
|
||||
if (id == 1) {
|
||||
// restore default settings for the relevant keys
|
||||
let keys = ['shortcut-text', 'hotkeys-overlay', 'shortcut-timeout'];
|
||||
let keys = ['shortcut-text', 'hotkeys-overlay', 'overlay-timeout'];
|
||||
keys.forEach(function(val) {
|
||||
this._settings.set_value(val, this._settings.get_default_value(val));
|
||||
}, this);
|
||||
|
||||
@@ -157,8 +157,13 @@
|
||||
<summary>Keybinding to show the dock and the number overlay.</summary>
|
||||
<description>Behavior depends on hotkeys-show-dock and hotkeys-overlay.</description>
|
||||
</key>
|
||||
<key type="d" name="shortcut-timeout">
|
||||
<default>2</default>
|
||||
<key type="i" name="shortcut-timeout">
|
||||
<default>2000</default>
|
||||
<summary>Timeout to hide the dock, in seconds</summary>
|
||||
<description>Sets the time duration before the dock is hidden again.</description>
|
||||
</key>
|
||||
<key type="i" name="overlay-timeout">
|
||||
<default>750</default>
|
||||
<summary>Timeout to hide the dock, in seconds</summary>
|
||||
<description>Sets the time duration before the dock is hidden again.</description>
|
||||
</key>
|
||||
|
||||
Reference in New Issue
Block a user