diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp --- a/autotests/test_plugin_effectloader.cpp +++ b/autotests/test_plugin_effectloader.cpp @@ -116,6 +116,7 @@ QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << false; QTest::newRow("DialogParent") << QStringLiteral("kwin4_effect_dialogparent") << false; QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << false; + QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << false; QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << false; QTest::newRow("ScaleIn") << QStringLiteral("kwin4_effect_scalein") << false; QTest::newRow("Translucency") << QStringLiteral("kwin4_effect_translucency") << false; diff --git a/autotests/test_scripted_effectloader.cpp b/autotests/test_scripted_effectloader.cpp --- a/autotests/test_scripted_effectloader.cpp +++ b/autotests/test_scripted_effectloader.cpp @@ -135,6 +135,7 @@ QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true; QTest::newRow("DialogParent") << QStringLiteral("kwin4_effect_dialogparent") << true; QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true; + QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true; QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true; QTest::newRow("ScaleIn") << QStringLiteral("kwin4_effect_scalein") << true; QTest::newRow("Translucency") << QStringLiteral("kwin4_effect_translucency") << true; @@ -165,6 +166,7 @@ << QStringLiteral("kwin4_effect_fade") << QStringLiteral("kwin4_effect_fadedesktop") << QStringLiteral("kwin4_effect_login") + << QStringLiteral("kwin4_effect_logout") << QStringLiteral("kwin4_effect_maximize") << QStringLiteral("kwin4_effect_scalein") << QStringLiteral("kwin4_effect_translucency"); @@ -190,6 +192,7 @@ QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true; QTest::newRow("DialogParent") << QStringLiteral("kwin4_effect_dialogparent") << true; QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true; + QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true; QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true; QTest::newRow("ScaleIn") << QStringLiteral("kwin4_effect_scalein") << true; QTest::newRow("Translucency") << QStringLiteral("kwin4_effect_translucency") << true; @@ -340,6 +343,7 @@ plugins.writeEntry(kwin4 + QStringLiteral("fadeEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("fadedesktopEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("loginEnabled"), false); + plugins.writeEntry(kwin4 + QStringLiteral("logoutEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("maximizeEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("minimizeanimationEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("scaleinEnabled"), false); diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -133,6 +133,7 @@ add_subdirectory( fade ) add_subdirectory( fadedesktop ) add_subdirectory( login ) +add_subdirectory( logout ) add_subdirectory( maximize ) add_subdirectory( morphingpopups ) add_subdirectory( scalein ) diff --git a/effects/logout/CMakeLists.txt b/effects/logout/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/effects/logout/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(package) diff --git a/effects/logout/package/CMakeLists.txt b/effects/logout/package/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/effects/logout/package/CMakeLists.txt @@ -0,0 +1,6 @@ +install(DIRECTORY contents DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/effects/kwin4_effect_logout) +install(FILES metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/effects/kwin4_effect_logout) + +install(FILES metadata.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/${KWIN_NAME} + RENAME kwin4_effect_logout.desktop) diff --git a/effects/logout/package/contents/code/main.js b/effects/logout/package/contents/code/main.js new file mode 100644 --- /dev/null +++ b/effects/logout/package/contents/code/main.js @@ -0,0 +1,58 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2007 Lubos Lunak + Copyright (C) 2013 Martin Gräßlin + Copyright (C) 2017 Marco Martin + +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 . +*********************************************************************/ +/*global effect, effects, animate, animationTime, Effect*/ +var logoutEffect = { + duration: animationTime(800), + loadConfig: function () { + "use strict"; + logoutEffect.duration = animationTime(800); + }, + isLogoutWindow: function (window) { + "use strict"; + var windowClass = window.windowClass; + if (windowClass === "ksmserver ksmserver") { + return true; + } + return false; + }, + opened: function (window) { + "use strict"; + if (!logoutEffect.isLogoutWindow(window)) { + return; + } + animate({ + window: window, + duration: logoutEffect.duration, + type: Effect.Opacity, + from: 0.0, + to: 1.0 + }); + }, + init: function () { + "use strict"; + logoutEffect.loadConfig(); + effects.windowAdded.connect(logoutEffect.opened); + effects.windowShown.connect(logoutEffect.opened); + } +}; +logoutEffect.init(); + diff --git a/effects/logout/package/metadata.desktop b/effects/logout/package/metadata.desktop new file mode 100644 --- /dev/null +++ b/effects/logout/package/metadata.desktop @@ -0,0 +1,22 @@ +[Desktop Entry] +Name=logout +Icon=preferences-system-windows-effect-logout +Comment=Smoothly fade to the desktop when logging in + +Type=Service +X-KDE-ServiceTypes=KWin/Effect,KCModule +X-KDE-PluginInfo-Author=Lubos Lunak, Kai Uwe Broulik, Martin Gräßlin, Marco MArtin +X-KDE-PluginInfo-Email=l.lunak@kde.org, kde@privat.broulik.de, mgraesslin@kde.org, mart@kde.org +X-KDE-PluginInfo-Name=kwin4_effect_logout +X-KDE-PluginInfo-Version=0.2.0 +X-KDE-PluginInfo-Category=Appearance +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +X-KDE-Ordering=40 +X-Plasma-API=javascript +X-Plasma-MainScript=code/main.js +X-KDE-PluginKeyword=kwin4_effect_logout +X-KDE-Library=kcm_kwin4_genericscripted +X-KDE-ParentComponents=kwin4_effect_logout +X-KWin-Config-TranslationDomain=kwin_effects