diff --git a/desktoppackage/contents/views/Panel.qml b/desktoppackage/contents/views/Panel.qml --- a/desktoppackage/contents/views/Panel.qml +++ b/desktoppackage/contents/views/Panel.qml @@ -20,20 +20,131 @@ import QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.taskmanager 0.1 as TaskManager -PlasmaCore.FrameSvgItem { +Item { id: root - imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background" - - enabledBorders: panel.enabledBorders - property Item containment - property alias panelMask: root.mask + property alias panelMask: privateSwapper.mask + + QtObject { + id: privateSwapper + // Work around the fact that we can't use a ternary if in an alias + readonly property var mask: { + if (root.state == "opaque") { + return opaqueItem.mask + } else { + return translucentItem.mask + } + } + } readonly property bool verticalPanel: containment && containment.formFactor === PlasmaCore.Types.Vertical + TaskManager.VirtualDesktopInfo { + id: virtualDesktopInfo + } + + TaskManager.ActivityInfo { + id: activityInfo + } + + PlasmaCore.SortFilterModel { + id: visibleWindowsModel + filterRole: 'IsMinimized' + filterRegExp: 'false' + sourceModel: TaskManager.TasksModel { + filterByVirtualDesktop: true + filterByActivity: true + filterNotMaximized: true + filterByScreen: true + + screenGeometry: panel.screenGeometry + virtualDesktop: virtualDesktopInfo.currentDesktop + activity: activityInfo.currentActivity + + id: tasksModel + groupMode: TaskManager.TasksModel.GroupDisabled + } + } + + PlasmaCore.FrameSvgItem { + id: translucentItem + enabledBorders: panel.enabledBorders + anchors.fill: parent + + imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background" + } + + PlasmaCore.FrameSvgItem { + id: opaqueItem + enabledBorders: panel.enabledBorders + anchors.fill: parent + + imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "opaque/widgets/panel-background" + } + + transitions: [ + Transition { + from: "opaque" + to: "transparent" + SequentialAnimation { + ScriptAction { + script: { + translucentItem.visible = true + } + } + NumberAnimation { + target: opaqueItem + properties: "opacity" + from: 1 + to: 0 + duration: units.veryLongDuration + easing.type: Easing.InOutQuad + } + ScriptAction { + script: { + opaqueItem.visible = false + root.panelMaskChanged() + } + } + } + }, + Transition { + from: "transparent" + to: "opaque" + SequentialAnimation { + ScriptAction { + script: { + opaqueItem.visible = true + } + } + NumberAnimation { + target: opaqueItem + properties: "opacity" + from: 0 + to: 1 + duration: units.veryLongDuration + easing.type: Easing.InOutQuad + } + ScriptAction { + script: { + translucentItem.visible = false + root.panelMaskChanged() + } + } + } + } + ] + + state: visibleWindowsModel.count > 0 ? "opaque" : "transparent" + states: [ + State { name: "opaque" }, + State { name: "transparent" } + ] + function adjustPrefix() { if (!containment) { return "";