Commit 0e22088b authored by Thomas Lübking's avatar Thomas Lübking
Browse files

add "MinimizeAll" script

to compensate withdrawn core feature (which
though has been hidden so far)
parent 0b6a8047
......@@ -3,9 +3,11 @@ install( DIRECTORY videowall DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/script
install( DIRECTORY synchronizeskipswitcher DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/scripts )
install( DIRECTORY desktopchangeosd DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/scripts )
install( DIRECTORY enforcedeco DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/scripts )
install( DIRECTORY minimizeall DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/scripts )
# service files
install( FILES videowall/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-videowall.desktop )
install( FILES synchronizeskipswitcher/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-synchronizeskipswitcher.desktop )
install( FILES desktopchangeosd/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-desktopchangeosd.desktop )
install( FILES enforcedeco/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-enforcedeco.desktop )
install( FILES minimizeall/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME kwin-script-minimizeall.desktop )
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2014 Thomas Lübking <thomas.luebking@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
function isRelevant(client) {
return client.minimizable &&
(client.onAllDesktops || client.desktop === workspace.currentDesktop);
(!client.activities.length || client.activities.indexOf(workspace.currentActivity.toString()) > -1);
}
var minimizeAllWindows = function() {
var allClients = workspace.clientList();
var clients = [];
var minimize = true;
for (var i = 0; i < allClients.length; ++i) {
if (isRelevant(allClients[i])) {
clients.push(allClients[i]);
if (allClients[i].minimizedForMinimizeAll === true) {
minimize = false;
}
}
}
for (var i = 0; i < clients.length; ++i) {
if (minimize && clients[i].minimized)
continue;
clients[i].minimized = minimize;
clients[i].minimizedForMinimizeAll = minimize;
}
clients = [];
}
registerShortcut("MinimizeAll", "MinimizeAll", "Meta+Shift+D", minimizeAllWindows);
[Desktop Entry]
Name=MinimizeAll
Comment=Adds a shortcut to minimize all windows or unminize all such way minimized windows
Icon=preferences-system-windows-script-test
Type=Service
X-Plasma-API=javascript
X-Plasma-MainScript=code/main.js
X-KDE-PluginInfo-Author=Thomas Lübking
X-KDE-PluginInfo-Email=thomas.luebking@gmail.com
X-KDE-PluginInfo-Name=minimizeall
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-ServiceTypes=KWin/Script
X-KDE-PluginKeyword=minimizeall
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment