diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 057f2640..87b8c3db 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 b7459417..299864cf 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”. + + false + Show windows from all workspaces + + Whether to show windows from all workspaces or only the current one. + + false Show the window list on all monitors diff --git a/extensions/window-list/prefs.js b/extensions/window-list/prefs.js index 78792b5a..ea3cb753 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); } });