summaryrefslogtreecommitdiff
path: root/modules/bar/components/Tray.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-29 19:57:07 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-29 19:57:07 +1000
commitae878e390fef99c6e7867b97fced78567e058ad0 (patch)
tree15bf235fa19c9ed0aaf121c064d3215cb8db9506 /modules/bar/components/Tray.qml
parentfeat: bar bluetooth devices (diff)
downloadcaelestia-shell-ae878e390fef99c6e7867b97fced78567e058ad0.tar.gz
caelestia-shell-ae878e390fef99c6e7867b97fced78567e058ad0.tar.bz2
caelestia-shell-ae878e390fef99c6e7867b97fced78567e058ad0.zip
feat: bar system tray
Diffstat (limited to 'modules/bar/components/Tray.qml')
-rw-r--r--modules/bar/components/Tray.qml54
1 files changed, 54 insertions, 0 deletions
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
+ }
+ }
+ }
+}