pragma ComponentBehavior: Bound import qs.config import qs.custom import Quickshell import Quickshell.Hyprland import Quickshell.Services.SystemTray import Quickshell.Services.UPower import QtQuick Item { id: root required property PersistentProperties uiState required property Item wrapper required property HyprlandToplevel window anchors.centerIn: parent implicitWidth: (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + 30 implicitHeight: (content.children.find(c => c.shouldBeActive)?.implicitHeight ?? 0) + 20 readonly property color color: content.children.find(c => c.active)?.color ?? "transparent" clip: true Item { id: content anchors.fill: parent anchors.margins: 15 Popout { name: "nixos" source: "NixOS.qml" color: Config.colors.nixos } Popout { name: "activewindow" sourceComponent: ActiveWindow { uiState: root.uiState wrapper: root.wrapper window: root.window } color: Config.colors.activeWindow } Popout { name: "calendar" source: "Calendar.qml" color: Config.colors.calendar } Popout { name: "network" source: "Network.qml" color: Config.colors.network } Popout { name: "idleinhibit" source: "IdleInhibit.qml" color: Config.colors.idle } Popout { name: "battery" source: "Battery.qml" color: UPower.displayDevice.isLaptopBattery && UPower.onBattery && UPower.displayDevice.percentage < 0.15 ? Config.colors.batteryWarning : Config.colors.battery } Repeater { model: SystemTray.items Popout { id: trayMenu required property SystemTrayItem modelData required property int index anchors.verticalCenterOffset: -5 name: `traymenu${index}` sourceComponent: trayMenuComp color: Qt.tint(Config.colors.brown, Qt.alpha(Config.colors.yellow, Math.min(index / 8, 1))) Connections { target: root.wrapper function onHasCurrentChanged(): void { if (root.wrapper.hasCurrent && trayMenu.shouldBeActive) { trayMenu.sourceComponent = null; trayMenu.sourceComponent = trayMenuComp; } } } Component { id: trayMenuComp TrayMenu { popouts: root.wrapper trayItem: trayMenu.modelData.menu } } } } } component Popout: Loader { id: popout required property string name property bool shouldBeActive: root.wrapper.currentName === name property color color anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: -3 anchors.right: parent.right opacity: 0 scale: 0.8 active: false asynchronous: true states: State { name: "active" when: popout.shouldBeActive PropertyChanges { popout.active: true popout.opacity: 1 popout.scale: 1 } } transitions: [ Transition { from: "" to: "active" SequentialAnimation { PropertyAction { target: popout property: "active" } Anim { properties: "opacity,scale" } } } ] } }