From 16b90f2987f0fcce3b3ec9b2c2b02dd6f72b83da Mon Sep 17 00:00:00 2001 From: Hannes Date: Tue, 17 Feb 2026 14:34:18 +0100 Subject: [PATCH] added Tray --- modules/bar/Bar.qml | 1 + modules/bar/widgets/Tray.qml | 78 ++++++++++++++++++++++++++++++ modules/bar/widgets/Workspaces.qml | 2 +- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 modules/bar/widgets/Tray.qml diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index f4ec309..6ff84ee 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -72,6 +72,7 @@ PanelWindow { spacing: 8 // TODO: Add bluetooth, network, audio, power, maybe HW monitor + Tray{} Network {} PowerButton {} diff --git a/modules/bar/widgets/Tray.qml b/modules/bar/widgets/Tray.qml new file mode 100644 index 0000000..0c9c244 --- /dev/null +++ b/modules/bar/widgets/Tray.qml @@ -0,0 +1,78 @@ +import QtQuick +import Quickshell +import Quickshell.Hyprland +import Quickshell.Services.SystemTray +import "../../../colors" + +Row { // Workspace Row + id: trayRow + spacing: 8 + + Repeater { + model: SystemTray.items + + Rectangle { //trayItem + width: bar.height + height: bar.height + radius: 4 + color: "transparent" + border.width: 2 + + // Text { + // id: iconName + // text: modelData.Name + // anchors.centerIn: parent + // color: "white" + // font.pixelSize: 18 + // font.family: "Inter, sans-serif" + // } + MouseArea { + id: workspaceButton + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton + onClicked: (mouse) => { + switch (mouse.button) { + case Qt.LeftButton: + modelData.activate() + break + case Qt.MiddleButton: + modelData.secondaryActivate?.() + break + case Qt.RightButton: + modelData.activate() + break + } + } + + + Rectangle { + anchors.fill: parent + color: workspaceButton.containsMouse ? Colors.tertiaryContainer + : modelData.active ? Colors.primaryContainer + : Colors.secondaryContainer + border.color: workspaceButton.containsMouse ? Colors.tertiaryContainer_fg + : modelData.active ? Colors.primaryContainer_fg + : Colors.secondaryContainer_fg + radius: 6 + } + + } + + Image { // Image + id: iconImage + source: modelData.icon + fillMode: Image.PreserveAspectCrop + + anchors.centerIn: parent + + width: bar.height*0.75 + height: bar.height*0.75 + + asynchronous: true + cache: true + } + } + } +} \ No newline at end of file diff --git a/modules/bar/widgets/Workspaces.qml b/modules/bar/widgets/Workspaces.qml index 66917c1..5a35069 100644 --- a/modules/bar/widgets/Workspaces.qml +++ b/modules/bar/widgets/Workspaces.qml @@ -13,7 +13,7 @@ Row { // Workspace Row model: Hyprland.workspaces Rectangle { //workspace - visible: modelData.monitor === thisMonitor + visible: modelData.monitor === thisMonitor width: workspaceNum.width + 26 height: workspaceNum.height + 8 radius: 4