From ae878e390fef99c6e7867b97fced78567e058ad0 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 29 Apr 2025 19:57:07 +1000 Subject: feat: bar system tray --- modules/bar/components/Tray.qml | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 modules/bar/components/Tray.qml (limited to 'modules/bar/components') diff --git a/modules/bar/components/Tray.qml b/modules/bar/components/Tray.qml new file mode 100644 index 0000000..08b638d --- /dev/null +++ b/modules/bar/components/Tray.qml @@ -0,0 +1,54 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell +import Quickshell.Widgets +import Quickshell.Services.SystemTray +import QtQuick +import Qt5Compat.GraphicalEffects + +BoxLayout { + id: root + + Repeater { + model: SystemTray.items + + MouseArea { + id: item + + required property SystemTrayItem modelData + + acceptedButtons: Qt.LeftButton | Qt.RightButton + width: Math.round(Appearance.font.size.large * 1.2) + height: Math.round(Appearance.font.size.large * 1.2) + + onClicked: event => { + if (event.button === Qt.LeftButton) + modelData.activate(); + else if (modelData.hasMenu) + menu.open(); + } + + QsMenuAnchor { + id: menu + + menu: item.modelData.menu + anchor.window: QsWindow.window + } + + IconImage { + id: icon + + visible: false + source: item.modelData.icon + anchors.fill: parent + } + + ColorOverlay { + anchors.fill: icon + source: icon + color: Appearance.colours.lavender + } + } + } +} -- cgit v1.2.3-freya