[gnome-shell-extensions/gnome-3-0] Add a new mode to optionally restrict window selection to just those in the current workspace. If th



commit efc2923919a72196653d85a065a25f335226130f
Author: Lance <windchine gmail com>
Date:   Sat Nov 26 08:41:41 2011 +0000

    Add a new mode to optionally restrict window selection to just those in the current workspace. If there are no windows in the current workspace then the selection reverts to the full session window list.
    
    This option is activated and controlled with:
    
            gsettings set org.gnome.shell.extensions.alternate-tab just-current-workspace true
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664409

 extensions/alternate-tab/Makefile.am               |   11 +++++++++
 extensions/alternate-tab/extension.js              |   24 ++++++++++++++++---
 ...e.shell.extensions.alternate-tab.gschema.xml.in |   12 ++++++++++
 3 files changed, 43 insertions(+), 4 deletions(-)
---
diff --git a/extensions/alternate-tab/Makefile.am b/extensions/alternate-tab/Makefile.am
index b8fde76..2e3930e 100644
--- a/extensions/alternate-tab/Makefile.am
+++ b/extensions/alternate-tab/Makefile.am
@@ -1,3 +1,14 @@
 EXTENSION_ID = alternate-tab
 
 include ../../extension.mk
+
+gschemas_in = org.gnome.shell.extensions.alternate-tab.gschema.xml.in
+
+ INTLTOOL_XML_NOMERGE_RULE@
+
+gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml)
+
+ GSETTINGS_RULES@
+
+CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS)
+EXTRA_DIST += $(gschemas_in)
diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js
index 8ae0d5c..11735f0 100644
--- a/extensions/alternate-tab/extension.js
+++ b/extensions/alternate-tab/extension.js
@@ -1,6 +1,7 @@
 /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
 
 const Clutter = imports.gi.Clutter;
+const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Shell= imports.gi.Shell;
@@ -11,6 +12,9 @@ const Main = imports.ui.main;
 const Tweener = imports.ui.tweener;
 const WindowManager = imports.ui.windowManager;
 
+const SETTINGS_SCHEMA = 'org.gnome.shell.extensions.alternate-tab';
+const SETTINGS_JUST_CUR_WS = 'just-current-workspace';
+
 function AltTabPopup2() {
     this._init();
 }
@@ -45,19 +49,31 @@ AltTabPopup2.prototype = {
 
     show : function(backward) {
         let windows = global.get_window_actors();
-
+        let activeWorkspace = global.screen.get_active_workspace();
 	let list = '';
 	let normal_windows= [];
+        let normal_windows_all= [];
+        let normal_windows_ws= [];
 	let appIcons = [];
 	let tracker = Shell.WindowTracker.get_default();
 	let apps = tracker.get_running_apps ('');
+        let settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
+        let justCurrentWS = settings.get_boolean(SETTINGS_JUST_CUR_WS);
 
 	for (let w = windows.length-1; w >= 0; w--) {
 	    let win = windows[w].get_meta_window();
 	    if (win.window_type == 0) {
-	        normal_windows.push(win);
-	    }
-	}
+	        normal_windows_all.push(win);
+                if(win.get_workspace() == activeWorkspace)
+                    normal_windows_ws.push(win);
+            }
+        }
+
+        if(justCurrentWS && normal_windows_ws.length)
+            normal_windows = normal_windows_ws;
+        else
+            normal_windows = normal_windows_all;
+
 	normal_windows.sort(Lang.bind(this, this._sortWindows));
 
         if(normal_windows.length) {
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
new file mode 100644
index 0000000..4f0e56e
--- /dev/null
+++ b/extensions/alternate-tab/org.gnome.shell.extensions.alternate-tab.gschema.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist gettext-domain="gnome-shell-extensions">
+  <schema path="/org/gnome/shell/extensions/alternate-tab/" id="org.gnome.shell.extensions.alternate-tab">
+    <key type="b" name="just-current-workspace">
+      <default>false</default>
+      <summary>Alt-tab restricts selection to just current workspace</summary>
+      <description>Alt-tab will only show windows in the current workspace. If there are no windows in the current workspace then windows from all workspaces are shown.</description>
+    </key>
+  </schema>
+</schemalist>
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]