mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Merge branch 'dev'
This commit is contained in:
39
Settings.ui
39
Settings.ui
@@ -305,7 +305,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">If set too low, the window preview of running applications may seem to close too quickly when trying to enter the popup. If set too high, the taskbar may feel slow to highlight applications.</property>
|
||||
<property name="label" translatable="yes">If set too low, the window preview of running applications may seem to close too quickly when trying to enter the popup. If set too high, the preview may linger too long when moving to an adjacent icon.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max_width_chars">40</property>
|
||||
<property name="xalign">0</property>
|
||||
@@ -364,6 +364,11 @@
|
||||
<property name="step_increment">0.01</property>
|
||||
<property name="page_increment">0.10000000000000001</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="preview_timeout_adjustment">
|
||||
<property name="upper">9999</property>
|
||||
<property name="step_increment">25</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="statusicon_padding_adjustment">
|
||||
<property name="lower">0.33000000000000002</property>
|
||||
<property name="upper">1</property>
|
||||
@@ -806,14 +811,17 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="margin_top">3</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="name">4</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">4</property>
|
||||
<property name="label" translatable="yes">Animate <i>Show Applications</i>.</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
@@ -957,6 +965,35 @@
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="preview_timeout_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="text" translatable="yes">0</property>
|
||||
<property name="adjustment">preview_timeout_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="preview_timeout_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">12</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Time (ms) before showing (100 is default)</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
16
prefs.js
16
prefs.js
@@ -155,6 +155,20 @@ const Settings = new Lang.Class({
|
||||
this._builder.get_object('show_window_previews_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('show-window-previews',
|
||||
this._builder.get_object('preview_timeout_spinbutton'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('show-window-previews',
|
||||
this._builder.get_object('preview_timeout_label'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout'));
|
||||
this._builder.get_object('preview_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
|
||||
this._settings.set_int('show-window-previews-timeout', widget.get_value());
|
||||
}));
|
||||
|
||||
this._settings.bind('isolate-workspaces',
|
||||
this._builder.get_object('isolate_workspaces_switch'),
|
||||
'active',
|
||||
@@ -254,7 +268,7 @@ const Settings = new Lang.Class({
|
||||
|
||||
this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout'));
|
||||
|
||||
this._builder.get_object('leave_timeout_spinbutton').connect('changed', Lang.bind (this, function(widget) {
|
||||
this._builder.get_object('leave_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
|
||||
this._settings.set_int('leave-timeout', widget.get_value());
|
||||
}));
|
||||
|
||||
|
||||
@@ -69,6 +69,11 @@
|
||||
<summary>Show window preview</summary>
|
||||
<description>Show preview of running window on hover of app icon</description>
|
||||
</key>
|
||||
<key type="i" name="show-window-previews-timeout">
|
||||
<default>100</default>
|
||||
<summary>Icon enter display time</summary>
|
||||
<description>Amount of time after entering icon to wait before displaying window preview if icon is not clicked or mouse has not left.</description>
|
||||
</key>
|
||||
<key type="b" name="isolate-workspaces">
|
||||
<default>false</default>
|
||||
<summary>Provide workspace isolation</summary>
|
||||
|
||||
31
taskbar.js
31
taskbar.js
@@ -1226,14 +1226,37 @@ const taskbarAppIcon = new Lang.Class({
|
||||
// Creating a new menu manager for window previews as adding it to the
|
||||
// using the secondary menu's menu manager (which uses the "ignoreRelease"
|
||||
// function) caused the extension to crash.
|
||||
this._menuManagerWindowPreview = new PopupMenu.PopupMenuManager(this);
|
||||
this.menuManagerWindowPreview = new PopupMenu.PopupMenuManager(this);
|
||||
|
||||
this.windowPreview = new WindowPreview.thumbnailPreviewMenu(this, this._dtpSettings, this.menuManagerWindowPreview);
|
||||
|
||||
this.windowPreview = new WindowPreview.thumbnailPreviewMenu(this, this._dtpSettings);
|
||||
this.windowPreview.connect('open-state-changed', Lang.bind(this, function (menu, isPoppedUp) {
|
||||
if (!isPoppedUp)
|
||||
this._onMenuPoppedDown();
|
||||
}));
|
||||
this._menuManagerWindowPreview.addMenu(this.windowPreview);
|
||||
this.menuManagerWindowPreview.addMenu(this.windowPreview);
|
||||
|
||||
// grabHelper.grab() is usually called when the menu is opened. However, there seems to be a bug in the
|
||||
// underlying gnome-shell that causes all window contents to freeze if the grab and ungrab occur
|
||||
// in quick succession (for example, clicking the icon as the preview window is opening)
|
||||
// So, instead I'll issue the grab when the preview menu is actually entered.
|
||||
// Alternatively, I was able to solve this by waiting a 100ms timeout to ensure the menu was
|
||||
// still open, but this waiting until the menu is entered seems a bit safer if it doesn't cause other issues
|
||||
let windowPreviewMenuData = this.menuManagerWindowPreview._menus[this.menuManagerWindowPreview._findMenu(this.windowPreview)];
|
||||
this.windowPreview.disconnect(windowPreviewMenuData.openStateChangeId);
|
||||
windowPreviewMenuData.openStateChangeId = this.windowPreview.connect('open-state-changed', Lang.bind(this.menuManagerWindowPreview, function(menu, open) {
|
||||
if (open) {
|
||||
if (this.activeMenu)
|
||||
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
||||
|
||||
// Mainloop.timeout_add(100, Lang.bind(this, function() {
|
||||
// if(menu.isOpen)
|
||||
// this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor, onUngrab: Lang.bind(this, this._closeMenu, menu) });
|
||||
// }));
|
||||
} else {
|
||||
this._grabHelper.ungrab({ actor: menu.actor });
|
||||
}
|
||||
}));
|
||||
|
||||
this.forcedOverview = false;
|
||||
},
|
||||
@@ -1345,7 +1368,6 @@ const taskbarAppIcon = new Lang.Class({
|
||||
|
||||
this.emit('menu-state-changed', true);
|
||||
|
||||
this.windowPreview.shouldOpen = false;
|
||||
this.windowPreview.close();
|
||||
|
||||
this.actor.set_hover(true);
|
||||
@@ -1390,7 +1412,6 @@ const taskbarAppIcon = new Lang.Class({
|
||||
},
|
||||
|
||||
activate: function(button) {
|
||||
this.windowPreview.shouldOpen = false;
|
||||
this.windowPreview.requestCloseMenu();
|
||||
|
||||
let event = Clutter.get_current_event();
|
||||
|
||||
@@ -56,8 +56,6 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
|
||||
this._source = source;
|
||||
this._app = this._source.app;
|
||||
this.shouldOpen = true;
|
||||
this.shouldClose = false;
|
||||
|
||||
this.actor.add_style_class_name('app-well-menu');
|
||||
this.actor.set_style("max-width: " + (Main.layoutManager.primaryMonitor.width - 22) + "px;");
|
||||
@@ -107,42 +105,62 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
},
|
||||
|
||||
_onMenuEnter: function () {
|
||||
this.shouldOpen = true;
|
||||
this.shouldClose = false;
|
||||
this.cancelClose();
|
||||
|
||||
// This grab is usually called when the menu is opened. However, there seems to be a bug in the
|
||||
// underlying gnome-shell that causes the window contents to freeze if the grab and ungrab occur
|
||||
// in quick succession (for example, clicking the icon as the preview window is opening)
|
||||
// So, instead I'll issue the grab when the preview menu is actually entered.
|
||||
this._source.menuManagerWindowPreview._grabHelper.grab({ actor: this.actor, focus: this.sourceActor,
|
||||
onUngrab: Lang.bind(this, this.requestCloseMenu) });
|
||||
|
||||
this.hoverOpen();
|
||||
},
|
||||
|
||||
_onMenuLeave: function () {
|
||||
this.shouldOpen = false;
|
||||
this.shouldClose = true;
|
||||
Mainloop.timeout_add(Taskbar.DASH_ITEM_HOVER_TIMEOUT, Lang.bind(this, this.hoverClose));
|
||||
this.cancelOpen();
|
||||
this.cancelClose();
|
||||
|
||||
this._hoverCloseTimeoutId = Mainloop.timeout_add(Taskbar.DASH_ITEM_HOVER_TIMEOUT, Lang.bind(this, this.hoverClose));
|
||||
},
|
||||
|
||||
_onEnter: function () {
|
||||
this.shouldOpen = true;
|
||||
this.shouldClose = false;
|
||||
this.cancelOpen();
|
||||
this.cancelClose();
|
||||
|
||||
this.hoverOpen();
|
||||
this._hoverOpenTimeoutId = Mainloop.timeout_add(this._dtpSettings.get_int('show-window-previews-timeout'), Lang.bind(this, this.hoverOpen));
|
||||
},
|
||||
|
||||
_onLeave: function () {
|
||||
this.shouldClose = true;
|
||||
this.shouldOpen = false;
|
||||
this.cancelOpen();
|
||||
this.cancelClose();
|
||||
|
||||
Mainloop.timeout_add(this._dtpSettings.get_int('leave-timeout'), Lang.bind(this, this.hoverClose));
|
||||
this._hoverCloseTimeoutId = Mainloop.timeout_add(this._dtpSettings.get_int('leave-timeout'), Lang.bind(this, this.hoverClose));
|
||||
},
|
||||
|
||||
cancelOpen: function () {
|
||||
if(this._hoverOpenTimeoutId) {
|
||||
Mainloop.source_remove(this._hoverOpenTimeoutId);
|
||||
this._hoverOpenTimeoutId = null;
|
||||
}
|
||||
},
|
||||
|
||||
cancelClose: function () {
|
||||
if(this._hoverCloseTimeoutId) {
|
||||
Mainloop.source_remove(this._hoverCloseTimeoutId);
|
||||
this._hoverCloseTimeoutId = null;
|
||||
}
|
||||
},
|
||||
|
||||
hoverOpen: function () {
|
||||
if (this.shouldOpen && !this.isOpen && this._dtpSettings.get_boolean("show-window-previews")) {
|
||||
this._hoverOpenTimeoutId = null;
|
||||
if (!this.isOpen && this._dtpSettings.get_boolean("show-window-previews"))
|
||||
this.popup();
|
||||
}
|
||||
},
|
||||
|
||||
hoverClose: function () {
|
||||
if (this.shouldClose) {
|
||||
this.close(~0);
|
||||
}
|
||||
this._hoverCloseTimeoutId = null;
|
||||
this.close(~0);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
@@ -166,6 +184,8 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
},
|
||||
|
||||
close: function(animate) {
|
||||
this.cancelOpen();
|
||||
|
||||
if (this.isOpen)
|
||||
this.emit('open-state-changed', false);
|
||||
if (this._activeMenuItem)
|
||||
|
||||
Reference in New Issue
Block a user