[gnome-shell-extensions] window-list: Support showing windows from all workspaces



commit 827af154b8a6f5a496b85b4df499cd012540131f
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 19 19:55:13 2019 +0200

    window-list: Support showing windows from all workspaces
    
    gnome-panel's window list applet has such an option, so let's support
    it as well.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/issues/154

 extensions/window-list/extension.js                | 35 ++++++++++++++++++++--
 ....gnome.shell.extensions.window-list.gschema.xml |  7 +++++
 extensions/window-list/prefs.js                    |  7 +++++
 3 files changed, 46 insertions(+), 3 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 057f264..87b8c3d 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -206,11 +206,18 @@ const WindowTitle = GObject.registerClass({
 
 const BaseButton = GObject.registerClass({
     GTypeName: 'WindowListBaseButton',
-    GTypeFlags: GObject.TypeFlags.ABSTRACT
+    GTypeFlags: GObject.TypeFlags.ABSTRACT,
+    Properties: {
+        'ignore-workspace': GObject.ParamSpec.boolean(
+            'ignore-workspace', 'ignore-workspace', 'ignore-workspace',
+            GObject.ParamFlags.READWRITE,
+            false)
+    }
 }, class BaseButton extends St.Button {
     _init(perMonitor, monitorIndex) {
         this._perMonitor = perMonitor;
         this._monitorIndex = monitorIndex;
+        this._ignoreWorkspace = false;
 
         super._init({
             style_class: 'window-button',
@@ -245,6 +252,22 @@ const BaseButton = GObject.registerClass({
         return this.has_style_class_name('focused');
     }
 
+    // eslint-disable-next-line camelcase
+    get ignore_workspace() {
+        return this._ignoreWorkspace;
+    }
+
+    // eslint-disable-next-line camelcase
+    set ignore_workspace(ignore) {
+        if (this._ignoreWorkspace == ignore)
+            return;
+
+        this._ignoreWorkspace = ignore;
+        this.notify('ignore-workspace');
+
+        this._updateVisibility();
+    }
+
     activate() {
         if (this.active)
             return;
@@ -288,7 +311,7 @@ const BaseButton = GObject.registerClass({
         let workspace = global.workspace_manager.get_active_workspace();
 
         return !window.skip_taskbar &&
-               window.located_on_workspace(workspace) &&
+               (this._ignoreWorkspace || window.located_on_workspace(workspace)) &&
                (!this._perMonitor || window.get_monitor() == this._monitorIndex);
     }
 
@@ -533,7 +556,9 @@ const AppButton = GObject.registerClass({
     }
 
     _updateVisibility() {
-        if (!this._perMonitor) {
+        if (this._ignoreWorkspace) {
+            this.visible = true;
+        } else if (!this._perMonitor) {
             // fast path: use ShellApp API to avoid iterating over all windows.
             let workspace = global.workspace_manager.get_active_workspace();
             this.visible = this.app.is_on_workspace(workspace);
@@ -917,6 +942,8 @@ const WindowList = GObject.registerClass({
 
     _addApp(app) {
         let button = new AppButton(app, this._perMonitor, this._monitor.index);
+        this._settings.bind('display-all-workspaces',
+            button, 'ignore-workspace', Gio.SettingsBindFlags.GET);
         this._windowList.layout_manager.pack(button,
             true, true, true,
             Clutter.BoxAlignment.START,
@@ -945,6 +972,8 @@ const WindowList = GObject.registerClass({
             return;
 
         let button = new WindowButton(win, this._perMonitor, this._monitor.index);
+        this._settings.bind('display-all-workspaces',
+            button, 'ignore-workspace', Gio.SettingsBindFlags.GET);
         this._windowList.layout_manager.pack(button,
             true, true, true,
             Clutter.BoxAlignment.START,
diff --git a/extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml 
b/extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml
index b745941..299864c 100644
--- a/extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml
+++ b/extensions/window-list/org.gnome.shell.extensions.window-list.gschema.xml
@@ -15,6 +15,13 @@
         window list. Possible values are “never”, “auto” and “always”.
       </description>
     </key>
+    <key name="display-all-workspaces" type="b">
+      <default>false</default>
+      <summary>Show windows from all workspaces</summary>
+      <description>
+        Whether to show windows from all workspaces or only the current one.
+      </description>
+    </key>
     <key name="show-on-all-monitors" type="b">
       <default>false</default>
       <summary>Show the window list on all monitors</summary>
diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js
index 78792b5..ea3cb75 100644
--- a/extensions/window-list/prefs.js
+++ b/extensions/window-list/prefs.js
@@ -77,6 +77,13 @@ class WindowListPrefsWidget extends Gtk.Grid {
         });
         this._settings.bind('show-on-all-monitors', check, 'active', Gio.SettingsBindFlags.DEFAULT);
         this.add(check);
+
+        check = new Gtk.CheckButton({
+            label: _('Show windows from all workspaces'),
+            margin_top: 6
+        });
+        this._settings.bind('display-all-workspaces', check, 'active', Gio.SettingsBindFlags.DEFAULT);
+        this.add(check);
     }
 });
 


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