From 530682f7b8273cf42cd14ccd8d0dc6cd64f81c58 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 7 Oct 2016 15:21:56 +0100 Subject: [PATCH] Add possible border handling in minimize all script Summary: Adds screen edge handling in minimize all script. Test Plan: With a hacked KCM, setting the option works perfectly and updates correctly adding/removing the edge bindings as appropriate. Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D2263 --- scripts/minimizeall/contents/code/main.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/minimizeall/contents/code/main.js b/scripts/minimizeall/contents/code/main.js index a8e17e8000..d87c187a47 100644 --- a/scripts/minimizeall/contents/code/main.js +++ b/scripts/minimizeall/contents/code/main.js @@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ +var registeredBorders = []; + function isRelevant(client) { return client.minimizable && (client.onAllDesktops || client.desktop === workspace.currentDesktop); @@ -48,4 +50,21 @@ var minimizeAllWindows = function() { clients = []; } +function init() { + for (var i in registeredBorders) { + unregisterScreenEdge(registeredBorders[i]); + } + + registeredBorders = []; + + var borders = readConfig("BorderActivate", "").toString().split(","); + for (var i in borders) { + registeredBorders.push(borders[i]); + registerScreenEdge(borders[i], minimizeAllWindows); + } +} + +options.configChanged.connect(init); + registerShortcut("MinimizeAll", "MinimizeAll", "Meta+Shift+D", minimizeAllWindows); +init();