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
This commit is contained in:
David Edmundson 2016-10-07 15:21:56 +01:00
parent 4bb12f3f01
commit 530682f7b8

View file

@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/ *********************************************************************/
var registeredBorders = [];
function isRelevant(client) { function isRelevant(client) {
return client.minimizable && return client.minimizable &&
(client.onAllDesktops || client.desktop === workspace.currentDesktop); (client.onAllDesktops || client.desktop === workspace.currentDesktop);
@ -48,4 +50,21 @@ var minimizeAllWindows = function() {
clients = []; 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); registerShortcut("MinimizeAll", "MinimizeAll", "Meta+Shift+D", minimizeAllWindows);
init();