// SPDX-FileCopyrightText: 2024 Oliver Beard // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL // // Taken from plasma-welcome's private mocks. The original highlighted the tray // with the theme's tabbar through KSvg; KOutNet has no Plasma theme to resolve // that through, so the highlight is drawn here instead, as a rounded overlay in // the theme's colours. import QtQuick import koutnet.app import QtQuick.Layouts import org.kde.kirigami as Kirigami Item { id: applet property bool active: false property int activeIconIndex: -1 // -1 entire applet, else index of tray icon default property alias children: iconsLayout.children implicitWidth: trayLayout.width implicitHeight: 44 // Default panel height Layout.preferredWidth: implicitWidth Rectangle { x: ((activeIconIndex == -1) ? 0 : (30 * activeIconIndex + 2)) - Kirigami.Units.largeSpacing y: parent.y width: ((activeIconIndex === -1) ? parent.width : 30) + (Kirigami.Units.largeSpacing * 2) height: parent.height radius: Kirigami.Units.smallSpacing color: Qt.rgba(AppPalette.text.r, AppPalette.text.g, AppPalette.text.b, 0.12) Behavior on x { NumberAnimation { duration: Kirigami.Units.longDuration easing.type: Easing.InOutCubic } } Behavior on width { NumberAnimation { duration: Kirigami.Units.longDuration easing.type: Easing.InOutCubic } } opacity: active ? 1 : 0 visible: opacity > 0 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration easing.type: active ? Easing.OutCubic : Easing.InCubic } } } RowLayout { id: trayLayout anchors.centerIn: applet spacing: 0 RowLayout { id: iconsLayout Layout.leftMargin: 2 // For some reason, there's a Layout.rightMargin: 2 // 2px gap around the tray spacing: 0 } Kirigami.Icon { implicitWidth: Kirigami.Units.iconSizes.smallMedium implicitHeight: Kirigami.Units.iconSizes.smallMedium source: "arrow-up" } } }