add "MinimizeAll" script

to compensate withdrawn core feature (which
though has been hidden so far)
This commit is contained in:
Thomas Lübking 2015-02-22 16:41:45 +01:00
parent 0b6a804701
commit 0e22088bf4
3 changed files with 69 additions and 0 deletions

View file

@ -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 )

View file

@ -0,0 +1,48 @@
/********************************************************************
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);

View file

@ -0,0 +1,19 @@
[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