diff --git a/CMakeLists.txt b/CMakeLists.txt
index c741cb4b82..b5d44b10c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,6 +72,7 @@ endif( KWIN_BUILD_DECORATIONS )
add_subdirectory( data )
add_subdirectory( effects )
+add_subdirectory( tabbox )
########### next target ###############
@@ -231,17 +232,5 @@ install(TARGETS kwinnvidiahack ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_
install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
install( FILES kwin.notifyrc DESTINATION ${DATA_INSTALL_DIR}/kwin )
install( FILES org.kde.KWin.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
-install( FILES
- tabbox/qml/informative.qml
- tabbox/qml/big_icons.qml
- tabbox/qml/compact.qml
- tabbox/qml/desktop.qml
- tabbox/qml/small_icons.qml
- tabbox/qml/tabbox.qml
- tabbox/qml/text.qml
- tabbox/qml/thumbnails.qml
- tabbox/qml/IconTabBox.qml
- tabbox/qml/window_strip.qml
- DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
kde4_install_icons( ${ICON_INSTALL_DIR} )
diff --git a/kcmkwin/kwintabbox/layoutconfig.cpp b/kcmkwin/kwintabbox/layoutconfig.cpp
index 84b7d30845..d982bcf564 100644
--- a/kcmkwin/kwintabbox/layoutconfig.cpp
+++ b/kcmkwin/kwintabbox/layoutconfig.cpp
@@ -25,6 +25,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
#include
#include
@@ -32,6 +33,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
namespace KWin
@@ -208,23 +210,20 @@ LayoutModel::~LayoutModel()
void LayoutModel::init()
{
- QStringList layouts;
- layouts << "thumbnails" << "informative" << "compact" << "text" << "big_icons" << "small_icons";
- QStringList descriptions;
- descriptions << i18nc("Name for a window switcher layout showing live window thumbnails", "Thumbnails");
- descriptions << i18nc("Name for a window switcher layout showing icon, name and desktop", "Informative");
- descriptions << i18nc("Name for a window switcher layout showing only icon and name", "Compact");
- descriptions << i18nc("Name for a window switcher layout showing only the name", "Text");
- descriptions << i18nc("Name for a window switcher layout showing large icons", "Large Icons");
- descriptions << i18nc("Name for a window switcher layout showing small icons", "Small Icons");
-
- for (int i=0; iquery("KWin/WindowSwitcher");
+ foreach (KService::Ptr service, offers) {
+ const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString();
+ if (service->property("X-Plasma-API").toString() != "declarativeappletscript") {
+ continue;
}
+ const QString scriptName = service->property("X-Plasma-MainScript").toString();
+ const QString scriptFile = KStandardDirs::locate("data", "kwin/tabbox/" + pluginName + "/contents/" + scriptName);
+ if (scriptFile.isNull()) {
+ continue;
+ }
+ m_nameList << service->name();
+ m_pathList << scriptFile;
+ m_layoutList << pluginName;
}
}
@@ -254,11 +253,12 @@ int LayoutModel::rowCount (const QModelIndex& parent) const
QModelIndex LayoutModel::indexForLayoutName(const QString &name) const
{
// fallback for default
+ QString normalizedName = name.toLower().replace(' ', '_');
if (name == "Default" || name.isEmpty()) {
- return index(0);
+ normalizedName = "informative";
}
for (int i=0; i.
#include
#include
#include
+#include
#include
#include
#include
@@ -284,17 +285,36 @@ void DeclarativeView::updateQmlSource(bool force)
if (!force && tabBox->config().layoutName() == m_currentLayout) {
return;
}
- m_currentLayout = tabBox->config().layoutName();
- QString file = KStandardDirs::locate("data", "kwin/tabbox/" + m_currentLayout.toLower().replace(' ', '_') + ".qml");
if (m_mode == TabBoxConfig::DesktopTabBox) {
- file = KStandardDirs::locate("data", "kwin/tabbox/desktop.qml");
+ m_currentLayout = tabBox->config().layoutName();
+ const QString file = KStandardDirs::locate("data", "kwin/tabbox/desktop.qml");
+ rootObject()->setProperty("source", QUrl(file));
+ return;
}
- if (file.isNull()) {
- // fallback to default
- if (m_mode == TabBoxConfig::ClientTabBox) {
- file = KStandardDirs::locate("data", "kwin/tabbox/informative.qml");
+ QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(tabBox->config().layoutName());
+ KService::List offers = KServiceTypeTrader::self()->query("KWin/WindowSwitcher", constraint);
+ if (offers.isEmpty()) {
+ // load default
+ constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg("informative");
+ offers = KServiceTypeTrader::self()->query("KWin/WindowSwitcher", constraint);
+ if (offers.isEmpty()) {
+ kDebug(1212) << "could not find default window switcher layout";
+ return;
}
}
+ m_currentLayout = tabBox->config().layoutName();
+ KService::Ptr service = offers.first();
+ const QString pluginName = service->property("X-KDE-PluginInfo-Name").toString();
+ if (service->property("X-Plasma-API").toString() != "declarativeappletscript") {
+ kDebug(1212) << "Window Switcher Layout is no declarativeappletscript";
+ return;
+ }
+ const QString scriptName = service->property("X-Plasma-MainScript").toString();
+ const QString file = KStandardDirs::locate("data", "kwin/tabbox/" + pluginName + "/contents/" + scriptName);
+ if (file.isNull()) {
+ kDebug(1212) << "Could not find QML file for window switcher";
+ return;
+ }
rootObject()->setProperty("source", QUrl(file));
}
diff --git a/tabbox/kwinwindowswitcher.desktop b/tabbox/kwinwindowswitcher.desktop
new file mode 100644
index 0000000000..4a575280f6
--- /dev/null
+++ b/tabbox/kwinwindowswitcher.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KWin/WindowSwitcher
+
+Comment=KWin Window Switcher Layout
+
+[PropertyDef::X-Plasma-API]
+Type=QString
+
+[PropertyDef::X-Plasma-MainScript]
+Type=QString
diff --git a/tabbox/qml/CMakeLists.txt b/tabbox/qml/CMakeLists.txt
new file mode 100644
index 0000000000..d6771e068b
--- /dev/null
+++ b/tabbox/qml/CMakeLists.txt
@@ -0,0 +1,24 @@
+install( FILES tabbox.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( FILES desktop.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+
+# packages
+install( DIRECTORY clients/big_icons DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( DIRECTORY clients/compact DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( DIRECTORY clients/informative DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( DIRECTORY clients/small_icons DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( DIRECTORY clients/text DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( DIRECTORY clients/thumbnails DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+install( DIRECTORY clients/window_strip DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox )
+
+# service files
+install( FILES clients/big_icons/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_big_icons.desktop )
+install( FILES clients/compact/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_compact.desktop )
+install( FILES clients/informative/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_informative.desktop )
+install( FILES clients/small_icons/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_small_icons.desktop )
+install( FILES clients/text/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_text.desktop )
+install( FILES clients/thumbnails/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_thumbnails.desktop )
+install( FILES clients/window_strip/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin RENAME kwin4_window_switcher_window_strip.desktop )
+
+# install additional icon tabbox into those that need it
+install (FILES IconTabBox.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox/big_icons/contents/ui)
+install (FILES IconTabBox.qml DESTINATION ${DATA_INSTALL_DIR}/kwin/tabbox/small_icons/contents/ui)
diff --git a/tabbox/qml/big_icons.qml b/tabbox/qml/clients/big_icons/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/big_icons.qml
rename to tabbox/qml/clients/big_icons/contents/ui/main.qml
diff --git a/tabbox/qml/clients/big_icons/metadata.desktop b/tabbox/qml/clients/big_icons/metadata.desktop
new file mode 100644
index 0000000000..25579dc506
--- /dev/null
+++ b/tabbox/qml/clients/big_icons/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Large Icons
+Comment=A window switcher layout using large icons to represent the window
+Icon=preferences-system-windows-switcher-big-icons
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=big_icons
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service
diff --git a/tabbox/qml/compact.qml b/tabbox/qml/clients/compact/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/compact.qml
rename to tabbox/qml/clients/compact/contents/ui/main.qml
diff --git a/tabbox/qml/clients/compact/metadata.desktop b/tabbox/qml/clients/compact/metadata.desktop
new file mode 100644
index 0000000000..9617347434
--- /dev/null
+++ b/tabbox/qml/clients/compact/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Compact
+Comment=A compact window switcher layout
+Icon=preferences-system-windows-switcher-compact
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=compact
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service
diff --git a/tabbox/qml/informative.qml b/tabbox/qml/clients/informative/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/informative.qml
rename to tabbox/qml/clients/informative/contents/ui/main.qml
diff --git a/tabbox/qml/clients/informative/metadata.desktop b/tabbox/qml/clients/informative/metadata.desktop
new file mode 100644
index 0000000000..835e211092
--- /dev/null
+++ b/tabbox/qml/clients/informative/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Informative
+Comment=An informative window switcher layout including desktop name
+Icon=preferences-system-windows-switcher-informative
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=informative
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service
diff --git a/tabbox/qml/small_icons.qml b/tabbox/qml/clients/small_icons/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/small_icons.qml
rename to tabbox/qml/clients/small_icons/contents/ui/main.qml
diff --git a/tabbox/qml/clients/small_icons/metadata.desktop b/tabbox/qml/clients/small_icons/metadata.desktop
new file mode 100644
index 0000000000..c9d5cfeee2
--- /dev/null
+++ b/tabbox/qml/clients/small_icons/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Small Icons
+Comment=A window switcher layout using small icons to represent the window
+Icon=preferences-system-windows-switcher-small-icons
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=small_icons
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service
diff --git a/tabbox/qml/text.qml b/tabbox/qml/clients/text/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/text.qml
rename to tabbox/qml/clients/text/contents/ui/main.qml
diff --git a/tabbox/qml/clients/text/metadata.desktop b/tabbox/qml/clients/text/metadata.desktop
new file mode 100644
index 0000000000..c4cb2ccffe
--- /dev/null
+++ b/tabbox/qml/clients/text/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Text Icons
+Comment=A window switcher layout only showing window captions
+Icon=preferences-system-windows-switcher-text
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=text
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service
diff --git a/tabbox/qml/thumbnails.qml b/tabbox/qml/clients/thumbnails/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/thumbnails.qml
rename to tabbox/qml/clients/thumbnails/contents/ui/main.qml
diff --git a/tabbox/qml/clients/thumbnails/metadata.desktop b/tabbox/qml/clients/thumbnails/metadata.desktop
new file mode 100644
index 0000000000..424abcfd13
--- /dev/null
+++ b/tabbox/qml/clients/thumbnails/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Thumbnails
+Comment=A window switcher layout using live thumbnails
+Icon=preferences-system-windows-switcher-thumbnails
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=thumbnails
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service
diff --git a/tabbox/qml/window_strip.qml b/tabbox/qml/clients/window_strip/contents/ui/main.qml
similarity index 100%
rename from tabbox/qml/window_strip.qml
rename to tabbox/qml/clients/window_strip/contents/ui/main.qml
diff --git a/tabbox/qml/clients/window_strip/metadata.desktop b/tabbox/qml/clients/window_strip/metadata.desktop
new file mode 100644
index 0000000000..d25cc54b92
--- /dev/null
+++ b/tabbox/qml/clients/window_strip/metadata.desktop
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=Window Strip
+Comment=Window switcher layout for Plasma Active
+Icon=preferences-system-windows-switcher-window-strip
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Martin Gräßlin
+X-KDE-PluginInfo-Email=mgraesslin@kde.org
+X-KDE-PluginInfo-Name=window_strip
+X-KDE-PluginInfo-Version=1.0
+
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-ServiceTypes=KWin/WindowSwitcher
+Type=Service