From 9c6c00f8a3b2979f3c28619b3f4afe4e64738a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 7 Feb 2014 22:49:41 +0100 Subject: [PATCH] window-list: Restrict right-click actions to windows in list While the list of windows in the left-click menu is filtered by workspace, the minimize/maximize/close actions in the right-click menu apply to all application windows on all workspaces. This is fairly confusing, so restrict the actions to only apply to windows that do appear in the left-click list. https://bugzilla.gnome.org/show_bug.cgi?id=724134 --- extensions/window-list/extension.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index fed19158..a0c9dd45 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -271,7 +271,7 @@ const AppContextMenu = new Lang.Class({ this._minimizeItem = new PopupMenu.PopupMenuItem(_("Minimize all")); this._minimizeItem.connect('activate', Lang.bind(this, function() { - this._app.get_windows().forEach(function(w) { + this._getWindowList().forEach(function(w) { w.minimize(); }); })); @@ -279,7 +279,7 @@ const AppContextMenu = new Lang.Class({ this._unminimizeItem = new PopupMenu.PopupMenuItem(_("Unminimize all")); this._unminimizeItem.connect('activate', Lang.bind(this, function() { - this._app.get_windows().forEach(function(w) { + this._getWindowList().forEach(function(w) { w.unminimize(); }); })); @@ -287,7 +287,7 @@ const AppContextMenu = new Lang.Class({ this._maximizeItem = new PopupMenu.PopupMenuItem(_("Maximize all")); this._maximizeItem.connect('activate', Lang.bind(this, function() { - this._app.get_windows().forEach(function(w) { + this._getWindowList().forEach(function(w) { w.maximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL); }); @@ -296,7 +296,7 @@ const AppContextMenu = new Lang.Class({ this._unmaximizeItem = new PopupMenu.PopupMenuItem(_("Unmaximize all")); this._unmaximizeItem.connect('activate', Lang.bind(this, function() { - this._app.get_windows().forEach(function(w) { + this._getWindowList().forEach(function(w) { w.unmaximize(Meta.MaximizeFlags.HORIZONTAL | Meta.MaximizeFlags.VERTICAL); }); @@ -305,15 +305,22 @@ const AppContextMenu = new Lang.Class({ let item = new PopupMenu.PopupMenuItem(_("Close all")); item.connect('activate', Lang.bind(this, function() { - this._app.get_windows().forEach(function(w) { + this._getWindowList().forEach(function(w) { w.delete(global.get_current_time()); }); })); this.addMenuItem(item); }, + _getWindowList: function() { + let workspace = global.screen.get_active_workspace(); + return this._app.get_windows().filter(function(win) { + return win.located_on_workspace(workspace); + }); + }, + open: function(animate) { - let windows = this._app.get_windows(); + let windows = this._getWindowList(); this._minimizeItem.actor.visible = windows.some(function(w) { return !w.minimized; });