[gnome-shell-extensions] alternate-tab: optionally highlight selected window in workspace&icons mode
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] alternate-tab: optionally highlight selected window in workspace&icons mode
- Date: Fri, 10 Feb 2012 14:23:15 +0000 (UTC)
commit 1dca3fecaa214d3cbbc815eabdae752511db8c70
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri Feb 10 14:52:54 2012 +0100
alternate-tab: optionally highlight selected window in workspace&icons mode
Optionally, bring the selected window to front before dismissing
the popup, in a manner similar to cycle-windows keybinding (but
without the rendering artifacts, and without application grouping).
Based on a patch by Pallai Roland <dap magex hu>
extensions/alternate-tab/extension.js | 51 ++++++++++++++++++++
...e.shell.extensions.alternate-tab.gschema.xml.in | 5 ++
2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js
index d0fd2fe..af531f9 100644
--- a/extensions/alternate-tab/extension.js
+++ b/extensions/alternate-tab/extension.js
@@ -36,6 +36,7 @@ const POPUP_DELAY_TIMEOUT = 150; // milliseconds
const SETTINGS_BEHAVIOUR_KEY = 'behaviour';
const SETTINGS_FIRST_TIME_KEY = 'first-time';
+const SETTINGS_HIGHLIGHT_SELECTED_KEY = 'highlight-selected';
const AltTabPopupWorkspaceIcons = new Lang.Class({
Name: 'AlternateTab.AltTabPopupWorkspaceIcons',
@@ -78,6 +79,8 @@ const AltTabPopupWorkspaceIcons = new Lang.Class({
this.actor.show();
this.actor.get_allocation_box();
+ this._highlight_selected = settings.get_boolean(SETTINGS_HIGHLIGHT_SELECTED_KEY);
+
// Make the initial selection
if (binding == 'switch_group') {
//see AltTab.AltTabPopup.show function
@@ -119,12 +122,60 @@ const AltTabPopupWorkspaceIcons = new Lang.Class({
return true;
},
+ _select : function(app, window, forceAppFocus) {
+ if (app != this._currentApp || window == null) {
+ if (this._thumbnails)
+ this._destroyThumbnails();
+ }
+
+ if (this._thumbnailTimeoutId != 0) {
+ Mainloop.source_remove(this._thumbnailTimeoutId);
+ this._thumbnailTimeoutId = 0;
+ }
+
+ this._thumbnailsFocused = (window != null) && !forceAppFocus;
+
+ this._currentApp = app;
+ this._currentWindow = window ? window : -1;
+ this._appSwitcher.highlight(app, this._thumbnailsFocused);
+
+ if (window != null) {
+ if (!this._thumbnails)
+ this._createThumbnails();
+ this._currentWindow = window;
+ this._thumbnails.highlight(window, forceAppFocus);
+ } else if (this._appIcons[this._currentApp].cachedWindows.length > 1 &&
+ !forceAppFocus) {
+ this._thumbnailTimeoutId = Mainloop.timeout_add (
+ THUMBNAIL_POPUP_TIME,
+ Lang.bind(this, this._timeoutPopupThumbnails));
+ }
+ if (this._highlight_selected) {
+ let current_app = this._appIcons[this._currentApp];
+ Main.activateWindow(current_app.cachedWindows[0]);
+ }
+ },
_finish : function() {
let app = this._appIcons[this._currentApp];
if (!app)
return;
+ /*
+ * We've to restore the original Z-depth and order of all windows.
+ *
+ * Gnome-shell doesn't give an option to change Z-depth without
+ * messing the window's user_time.
+ *
+ * Pointless if the popup wasn't showed.
+ */
+ if (this._highlight_selected && this.actor.opacity == 255) {
+ for (let i = this._appIcons.length - 2; i >= 0; i--) {
+ let app_walker = this._appIcons[i];
+ Main.activateWindow(app_walker.cachedWindows[0], global.get_current_time() - i - 1);
+ }
+ }
+
Main.activateWindow(app.cachedWindows[0]);
this.destroy();
}
diff --git a/extensions/alternate-tab/org.gnome.shell.extensions.alternate-tab.gschema.xml.in b/extensions/alternate-tab/org.gnome.shell.extensions.alternate-tab.gschema.xml.in
index 66861ad..c93172e 100644
--- a/extensions/alternate-tab/org.gnome.shell.extensions.alternate-tab.gschema.xml.in
+++ b/extensions/alternate-tab/org.gnome.shell.extensions.alternate-tab.gschema.xml.in
@@ -14,5 +14,10 @@
<_summary>Indicates if Alternate Tab is newly installed</_summary>
<_description>Ask the user for a default behaviour if true.</_description>
</key>
+ <key type="b" name="highlight-selected">
+ <default>false</default>
+ <summary>Bring each selected window to the front.</summary>
+ <description>Bring each window to the front in turn as Alt+Tab is pressed.</description>
+ </key>
</schema>
</schemalist>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]