mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Added settings entries for peek mode
This commit is contained in:
97
Settings.ui
97
Settings.ui
@@ -770,6 +770,12 @@
|
||||
<property name="step_increment">25</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="enter_peek_mode_timeout_adjustment">
|
||||
<property name="upper">9999</property>
|
||||
<property name="lower">50</property>
|
||||
<property name="step_increment">25</property>
|
||||
<property name="page_increment">100</property>
|
||||
</object>
|
||||
<object class="GtkBox" id="box_advanced_options">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -849,6 +855,70 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow" id="listboxrow_enter_peek_mode_timeout">
|
||||
<property name="width_request">100</property>
|
||||
<property name="height_request">80</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_enter_peek_mode_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="column_spacing">32</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="enter_peek_mode_timeout_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Enter window peeking mode timeout (ms)</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="enter_peek_mode_timeout_description">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Time of inactivity while hovering over a window preview needed to enter the window peeking mode.</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>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="enter_peek_mode_timeout_spinbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="width_chars">4</property>
|
||||
<property name="adjustment">enter_peek_mode_timeout_adjustment</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2033,6 +2103,33 @@
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="peek_mode_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">Enable window peeking</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="peek_mode_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
20
prefs.js
20
prefs.js
@@ -340,6 +340,18 @@ const Settings = new Lang.Class({
|
||||
this._builder.get_object('preview_timeout_label'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('peek-mode',
|
||||
this._builder.get_object('peek_mode_switch'),
|
||||
'active',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('show-window-previews',
|
||||
this._builder.get_object('peek_mode_switch'),
|
||||
'sensitive',
|
||||
Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings.bind('show-window-previews',
|
||||
this._builder.get_object('peek_mode_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) {
|
||||
@@ -520,11 +532,19 @@ const Settings = new Lang.Class({
|
||||
this._settings.set_int('leave-timeout', widget.get_value());
|
||||
}));
|
||||
|
||||
this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout'));
|
||||
|
||||
this._builder.get_object('enter_peek_mode_timeout_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
|
||||
this._settings.set_int('enter-peek-mode-timeout', widget.get_value());
|
||||
}));
|
||||
|
||||
dialog.connect('response', Lang.bind(this, function(dialog, id) {
|
||||
if (id == 1) {
|
||||
// restore default settings
|
||||
this._settings.set_value('leave-timeout', this._settings.get_default_value('leave-timeout'));
|
||||
this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout'));
|
||||
this._settings.set_value('enter-peek-mode-timeout', this._settings.get_default_value('enter-peek-mode-timeout'));
|
||||
this._builder.get_object('enter_peek_mode_timeout_spinbutton').set_value(this._settings.get_int('enter-peek-mode-timeout'));
|
||||
} else {
|
||||
// remove the settings box so it doesn't get destroyed;
|
||||
dialog.get_content_area().remove(box);
|
||||
|
||||
@@ -162,6 +162,11 @@
|
||||
<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="peek-mode">
|
||||
<default>true</default>
|
||||
<summary>Enable peek mode</summary>
|
||||
<description>Peek a window upon hover for some time</description>
|
||||
</key>
|
||||
<key type="b" name="isolate-workspaces">
|
||||
<default>false</default>
|
||||
<summary>Provide workspace isolation</summary>
|
||||
@@ -205,6 +210,11 @@
|
||||
<summary>Icon leave preview timeout</summary>
|
||||
<description>Amount of time to leave preview windows open when the mouse has left the application's icon.</description>
|
||||
</key>
|
||||
<key type="i" name="enter-peek-mode-timeout">
|
||||
<default>500</default>
|
||||
<summary>Enter window peeking mode timeout</summary>
|
||||
<description>Amount of time of inactivity to enter the window peeking mode when the mouse has entered a window preview.</description>
|
||||
</key>
|
||||
<key type="i" name="tray-size">
|
||||
<default>0</default>
|
||||
<summary>Tray font size</summary>
|
||||
|
||||
@@ -89,7 +89,6 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
|
||||
this._peekMode = false;
|
||||
this._peekModeEnterTimeoutId = 0;
|
||||
this._ENTER_PEEK_MODE_TIMEOUT = 500;
|
||||
this._peekModeDisableTimeoutId = 0;
|
||||
this._DISABLE_PEEK_MODE_TIMEOUT = 50;
|
||||
this._peekedWindow = null;
|
||||
@@ -98,6 +97,7 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
this._trackOpenWindowsId = null;
|
||||
this._trackClosedWindowsIds = null;
|
||||
this._peekModeOriginalWorkspace = null;
|
||||
this._peekModeCurrentWorkspace = null;
|
||||
},
|
||||
|
||||
requestCloseMenu: function() {
|
||||
@@ -217,7 +217,7 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
}));
|
||||
}
|
||||
|
||||
if(this._peekMode)
|
||||
if(this._dtpSettings.get_boolean('peek-mode') && this._peekMode)
|
||||
this._disablePeekMode();
|
||||
|
||||
this.isOpen = false;
|
||||
@@ -258,6 +258,7 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
});
|
||||
}
|
||||
});
|
||||
this._peekModeCurrentWorkspace = newWorkspace;
|
||||
},
|
||||
|
||||
_disablePeekMode: function() {
|
||||
@@ -273,9 +274,11 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
//If the old peeked window is exclusive to different workspace than original
|
||||
//then hide() all windows exclusive to the different workspace
|
||||
//and show() all windows exclusive to the original workspace (that weren't minimized)
|
||||
let locatedOnOriginalWorkspace = this._peekedWindow.located_on_workspace(this._peekModeOriginalWorkspace);
|
||||
let locatedOnOriginalWorkspace = this._peekModeCurrentWorkspace == this._peekModeOriginalWorkspace;
|
||||
if(!locatedOnOriginalWorkspace) {
|
||||
let differentWorkspace = this._peekedWindow.get_workspace();
|
||||
if(!differentWorkspace)
|
||||
differentWorkspace = this._peekModeCurrentWorkspace;
|
||||
this._emulateSwitchingWorkspaces(differentWorkspace, this._peekModeOriginalWorkspace);
|
||||
}
|
||||
|
||||
@@ -442,6 +445,7 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
//Save the visible windows in each workspace and lower their opacity
|
||||
this._peekModeSavedWorkspaces = [];
|
||||
this._peekModeOriginalWorkspace = global.screen.get_active_workspace();
|
||||
this._peekModeCurrentWorkspace = this._peekModeOriginalWorkspace;
|
||||
|
||||
for ( let wks=0; wks<global.screen.n_workspaces; ++wks ) {
|
||||
// construct a list with all windows
|
||||
@@ -488,6 +492,7 @@ const thumbnailPreviewMenu = new Lang.Class({
|
||||
_peekModeWindowClosed: function(window) {
|
||||
log("WINDOW CLOSED", window.title);
|
||||
log("Window group", global.window_group.get_children());
|
||||
log("Window workspace", window.get_workspace());
|
||||
|
||||
if(this._peekMode && window == this._peekedWindow)
|
||||
this._disablePeekMode();
|
||||
@@ -599,25 +604,26 @@ const thumbnailPreview = new Lang.Class({
|
||||
*/
|
||||
|
||||
let topMenu = this._getTopMenu();
|
||||
|
||||
if(topMenu._peekMode) {
|
||||
if(topMenu._peekModeDisableTimeoutId) {
|
||||
Mainloop.source_remove(topMenu._peekModeDisableTimeoutId);
|
||||
topMenu._peekModeDisableTimeoutId = null;
|
||||
if(topMenu._dtpSettings.get_boolean('peek-mode')) {
|
||||
if(topMenu._peekMode) {
|
||||
if(topMenu._peekModeDisableTimeoutId) {
|
||||
Mainloop.source_remove(topMenu._peekModeDisableTimeoutId);
|
||||
topMenu._peekModeDisableTimeoutId = null;
|
||||
}
|
||||
//Hide the old peeked window and show the window in preview
|
||||
topMenu._setPeekedWindow(this.window);
|
||||
//log("Peek mode window changed");
|
||||
} else if(!this.animatingOut) {
|
||||
//log("Motion event (enter), topMenu:", topMenu);
|
||||
//Remove old timeout and set a new one
|
||||
if(topMenu._peekModeEnterTimeoutId)
|
||||
Mainloop.source_remove(topMenu._peekModeEnterTimeoutId);
|
||||
topMenu._peekModeEnterTimeoutId = Mainloop.timeout_add(topMenu._dtpSettings.get_int('enter-peek-mode-timeout'), Lang.bind(this, function() {
|
||||
topMenu._enterPeekMode(this);
|
||||
}));
|
||||
//log("Set up timeout", topMenu._peekModeEnterTimeoutId);
|
||||
|
||||
}
|
||||
//Hide the old peeked window and show the window in preview
|
||||
topMenu._setPeekedWindow(this.window);
|
||||
//log("Peek mode window changed");
|
||||
} else if(!this.animatingOut) {
|
||||
//log("Motion event (enter), topMenu:", topMenu);
|
||||
//Remove old timeout and set a new one
|
||||
if(topMenu._peekModeEnterTimeoutId)
|
||||
Mainloop.source_remove(topMenu._peekModeEnterTimeoutId);
|
||||
topMenu._peekModeEnterTimeoutId = Mainloop.timeout_add(topMenu._ENTER_PEEK_MODE_TIMEOUT, Lang.bind(this, function() {
|
||||
topMenu._enterPeekMode(this);
|
||||
}));
|
||||
//log("Set up timeout", topMenu._peekModeEnterTimeoutId);
|
||||
|
||||
}
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
@@ -639,7 +645,6 @@ const thumbnailPreview = new Lang.Class({
|
||||
*/
|
||||
|
||||
let topMenu = this._getTopMenu();
|
||||
|
||||
//Kod z thumbnail menu
|
||||
if(topMenu._peekMode) {
|
||||
if(topMenu._peekModeDisableTimeoutId){
|
||||
@@ -802,12 +807,14 @@ const thumbnailPreview = new Lang.Class({
|
||||
activate: function() {
|
||||
let topMenu = this._getTopMenu();
|
||||
|
||||
if(topMenu._peekMode) {
|
||||
topMenu._disablePeekMode();
|
||||
}
|
||||
else if(topMenu._peekModeEnterTimeoutId) {
|
||||
Mainloop.source_remove(topMenu._peekModeEnterTimeoutId);
|
||||
topMenu._peekModeEnterTimeoutId = null;
|
||||
if(topMenu._dtpSettings.get_boolean('peek-mode')) {
|
||||
if(topMenu._peekMode) {
|
||||
topMenu._disablePeekMode();
|
||||
}
|
||||
else if(topMenu._peekModeEnterTimeoutId) {
|
||||
Mainloop.source_remove(topMenu._peekModeEnterTimeoutId);
|
||||
topMenu._peekModeEnterTimeoutId = null;
|
||||
}
|
||||
}
|
||||
|
||||
Main.activateWindow(this.window);
|
||||
@@ -818,15 +825,17 @@ const thumbnailPreview = new Lang.Class({
|
||||
_onMotionEvent: function() {
|
||||
//If in normal mode, then set new timeout for entering peek mode after removing the old one
|
||||
let topMenu = this._getTopMenu();
|
||||
if(!topMenu._peekMode && !this.animatingOut) {
|
||||
//log("Motion event, topMenu:", topMenu);
|
||||
//Remove old timeout and set a new one
|
||||
if(topMenu._peekModeEnterTimeoutId)
|
||||
Mainloop.source_remove(topMenu._peekModeEnterTimeoutId);
|
||||
topMenu._peekModeEnterTimeoutId = Mainloop.timeout_add(topMenu._ENTER_PEEK_MODE_TIMEOUT, Lang.bind(this, function() {
|
||||
topMenu._enterPeekMode(this);
|
||||
}));
|
||||
//log("Set up timeout", topMenu._peekModeEnterTimeoutId);
|
||||
if(topMenu._dtpSettings.get_boolean('peek-mode')) {
|
||||
if(!topMenu._peekMode && !this.animatingOut) {
|
||||
//log("Motion event, topMenu:", topMenu);
|
||||
//Remove old timeout and set a new one
|
||||
if(topMenu._peekModeEnterTimeoutId)
|
||||
Mainloop.source_remove(topMenu._peekModeEnterTimeoutId);
|
||||
topMenu._peekModeEnterTimeoutId = Mainloop.timeout_add(topMenu._dtpSettings.get_int('enter-peek-mode-timeout'), Lang.bind(this, function() {
|
||||
topMenu._enterPeekMode(this);
|
||||
}));
|
||||
//log("Set up timeout", topMenu._peekModeEnterTimeoutId);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user