diff --git a/app/indicator/factory.cpp b/app/indicator/factory.cpp index 4b90737c3..7616b680d 100644 --- a/app/indicator/factory.cpp +++ b/app/indicator/factory.cpp @@ -144,7 +144,8 @@ void Factory::reload(const QString &indicatorPath) } if ((metadata.pluginId() != "org.kde.latte.default") - && (metadata.pluginId() != "org.kde.latte.plasma")) { + && (metadata.pluginId() != "org.kde.latte.plasma") + && (metadata.pluginId() != "org.kde.latte.plasmatabstyle")) { if (!m_customPluginIds.contains(metadata.pluginId())) { m_customPluginIds << metadata.pluginId(); @@ -221,7 +222,7 @@ void Factory::removeIndicatorRecords(const QString &path) bool Factory::isCustomType(const QString &id) const { - return ((id != "org.kde.latte.default") && (id != "org.kde.latte.plasma")); + return ((id != "org.kde.latte.default") && (id != "org.kde.latte.plasma") && (id != "org.kde.latte.plasmatabstyle")); } bool Factory::metadataAreValid(KPluginMetaData &metadata) diff --git a/app/view/indicator/indicator.cpp b/app/view/indicator/indicator.cpp index 67051f02c..4c7140e0c 100644 --- a/app/view/indicator/indicator.cpp +++ b/app/view/indicator/indicator.cpp @@ -288,7 +288,7 @@ void Indicator::loadPlasmaComponent() { auto prevComponent = m_plasmaComponent; - KPluginMetaData metadata = m_corona->indicatorFactory()->metadata("org.kde.latte.plasma"); + KPluginMetaData metadata = m_corona->indicatorFactory()->metadata("org.kde.latte.plasmatabstyle"); QString uiPath = metadata.value("X-Latte-MainScript"); if (!uiPath.isEmpty()) { diff --git a/indicators/CMakeLists.txt b/indicators/CMakeLists.txt index 78d4b16b2..254c16e00 100644 --- a/indicators/CMakeLists.txt +++ b/indicators/CMakeLists.txt @@ -1,2 +1,3 @@ install(DIRECTORY default DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators) install(DIRECTORY org.kde.latte.plasma DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators) +install(DIRECTORY org.kde.latte.plasmatabstyle DESTINATION ${CMAKE_INSTALL_PREFIX}/share/latte/indicators) diff --git a/indicators/Messages.sh b/indicators/Messages.sh index 8d13643a3..5e46bcfab 100644 --- a/indicators/Messages.sh +++ b/indicators/Messages.sh @@ -1,4 +1,5 @@ #! /usr/bin/env bash $XGETTEXT `find default -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.default.pot -$XGETTEXT `find org.kde.latte.plasma -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.plasma.pot +$XGETTEXT `find org.kde.latte.plasma -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.plasma.pot +$XGETTEXT `find org.kde.latte.plasmatabstyle -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/latte_indicator_org.kde.latte.plasmatabstyle.pot diff --git a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml index 462ad1a07..facdefb02 100644 --- a/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml +++ b/indicators/org.kde.latte.plasma/package/ui/BackLayer.qml @@ -27,38 +27,12 @@ PlasmaCore.FrameSvgItem { id: frame property string basePrefix: "normal" - imagePath: root.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks" + imagePath: "widgets/tasks" rotation: root.reversedEnabled ? 180 : 0 - opacity: 1 //state === "hovered" ? 0.9 : 1 + opacity: 1 - prefix: { - if (root.usePlasmaTabsStyle) { - if (!indicator.isActive) { - return ""; - } - - if (plasmoid.location === PlasmaCore.Types.LeftEdge) { - return "west-active-tab"; - } - - if (plasmoid.location === PlasmaCore.Types.TopEdge) { - return "north-active-tab"; - } - - if (plasmoid.location === PlasmaCore.Types.RightEdge) { - return "east-active-tab"; - } - - if (plasmoid.location === PlasmaCore.Types.BottomEdge) { - return "south-active-tab"; - } - - return "south-active-tab"; - } else { - return root.taskPrefix(basePrefix); - } - } + prefix: root.taskPrefix(basePrefix) states: [ State { diff --git a/indicators/org.kde.latte.plasma/package/ui/main.qml b/indicators/org.kde.latte.plasma/package/ui/main.qml index af46f1ad2..deaa89f41 100644 --- a/indicators/org.kde.latte.plasma/package/ui/main.qml +++ b/indicators/org.kde.latte.plasma/package/ui/main.qml @@ -48,7 +48,6 @@ LatteComponents.IndicatorItem { && indicator.configuration.reversed - readonly property bool usePlasmaTabsStyle: false readonly property bool configurationIsReady: indicator && indicator.configuration //! Background Layer diff --git a/indicators/org.kde.latte.plasmatabstyle/metadata.desktop b/indicators/org.kde.latte.plasmatabstyle/metadata.desktop new file mode 100644 index 000000000..cb6698218 --- /dev/null +++ b/indicators/org.kde.latte.plasmatabstyle/metadata.desktop @@ -0,0 +1,20 @@ +[Desktop Entry] +Name=Plasma Tab Style +Comment=Plasma Tab style indicator for Latte + +Encoding=UTF-8 +Type=Service +Icon=latte-dock +X-Plasma-API=declarativeappletscript +X-KDE-ServiceTypes=Latte/Indicator + +X-Latte-MainScript=ui/main.qml + +X-KDE-PluginInfo-Author=Michail Vourlakos +X-KDE-PluginInfo-Email=mvourlakos@gmail.com +X-KDE-PluginInfo-Name=org.kde.latte.plasmatabstyle +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Category=Latte Indicator +X-KDE-PluginInfo-License=GPL v2+ +X-KDE-PluginInfo-EnabledByDefault=true + diff --git a/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml b/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml new file mode 100644 index 000000000..61fc41cfe --- /dev/null +++ b/indicators/org.kde.latte.plasmatabstyle/package/ui/BackLayer.qml @@ -0,0 +1,105 @@ +/* +* Copyright 2020 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock 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. +* +* Latte-Dock 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 . +*/ + +import QtQuick 2.0 + +import org.kde.plasma.core 2.0 as PlasmaCore + +import org.kde.latte 0.2 as Latte + +PlasmaCore.FrameSvgItem { id: frame + property string basePrefix: "normal" + + imagePath: "widgets/tabbar" + rotation: 0 + + opacity: 1 + + prefix: { + if (!indicator.isActive) { + return ""; + } + + if (plasmoid.location === PlasmaCore.Types.LeftEdge) { + return "west-active-tab"; + } + + if (plasmoid.location === PlasmaCore.Types.TopEdge) { + return "north-active-tab"; + } + + if (plasmoid.location === PlasmaCore.Types.RightEdge) { + return "east-active-tab"; + } + + if (plasmoid.location === PlasmaCore.Types.BottomEdge) { + return "south-active-tab"; + } + + return "south-active-tab"; + } + + states: [ + State { + name: "launcher" + when: indicator.isLauncher || (indicator.isApplet && !indicator.isActive) + + PropertyChanges { + target: frame + basePrefix: "" + } + }, + State { + name: "hovered" + when: indicator.isHovered && frame.hasElementPrefix("hover") + + PropertyChanges { + target: frame + basePrefix: "hover" + } + }, + State { + name: "attention" + when: indicator.inAttention + + PropertyChanges { + target: frame + basePrefix: "attention" + } + }, + State { + name: "minimized" + when: indicator.isMinimized + + PropertyChanges { + target: frame + basePrefix: "minimized" + } + }, + State { + name: "active" + when: indicator.isActive + + PropertyChanges { + target: frame + basePrefix: "focus" + } + } + ] +} diff --git a/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml b/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml new file mode 100644 index 000000000..de6f1e7f9 --- /dev/null +++ b/indicators/org.kde.latte.plasmatabstyle/package/ui/main.qml @@ -0,0 +1,44 @@ +/* +* Copyright 2020 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock 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. +* +* Latte-Dock 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 . +*/ + +import QtQuick 2.0 + +import org.kde.plasma.core 2.0 as PlasmaCore + +import org.kde.latte 0.2 as Latte +import org.kde.latte.components 1.0 as LatteComponents + +LatteComponents.IndicatorItem { + id: root + + lengthPadding: 0.08 + + //! Background Layer + Loader{ + id: backLayer + anchors.fill: parent + anchors.topMargin: plasmoid.location === PlasmaCore.Types.TopEdge ? indicator.screenEdgeMargin : 0 + anchors.bottomMargin: plasmoid.location === PlasmaCore.Types.BottomEdge ? indicator.screenEdgeMargin : 0 + anchors.leftMargin: plasmoid.location === PlasmaCore.Types.LeftEdge ? indicator.screenEdgeMargin : 0 + anchors.rightMargin: plasmoid.location === PlasmaCore.Types.RightEdge ? indicator.screenEdgeMargin : 0 + + active: level.isBackground && !indicator.isEmptySpace + sourceComponent: BackLayer{} + } +}