summaryrefslogtreecommitdiff
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
parentfeat: bar bluetooth devices (diff)
downloadcaelestia-shell-ae878e390fef99c6e7867b97fced78567e058ad0.tar.gz
caelestia-shell-ae878e390fef99c6e7867b97fced78567e058ad0.tar.bz2
caelestia-shell-ae878e390fef99c6e7867b97fced78567e058ad0.zip
feat: bar system tray
-rw-r--r--modules/bar/Bar.qml5
-rw-r--r--modules/bar/Pills.qml16
-rw-r--r--modules/bar/components/Tray.qml54
-rw-r--r--widgets/StyledText.qml1
-rw-r--r--widgets/StyledWindow.qml10
5 files changed, 82 insertions, 4 deletions
diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml
index 49ab55c..7608d49 100644
--- a/modules/bar/Bar.qml
+++ b/modules/bar/Bar.qml
@@ -10,14 +10,13 @@ import QtQuick.Controls
Variants {
model: Quickshell.screens
- WlrLayershell {
+ StyledWindow {
id: win
required property ShellScreen modelData
screen: modelData
- namespace: "caelestia-bar"
- color: "transparent"
+ name: "bar"
width: BarConfig.vertical ? BarConfig.preset.totalHeight : -1
height: BarConfig.vertical ? -1 : BarConfig.preset.totalHeight
diff --git a/modules/bar/Pills.qml b/modules/bar/Pills.qml
index 042e9c1..f608549 100644
--- a/modules/bar/Pills.qml
+++ b/modules/bar/Pills.qml
@@ -68,7 +68,11 @@ Item {
anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
}
- StatusIcons {
+ Tray {
+ id: tray
+
+ vertical: BarConfig.vertical
+
anchors.left: root.get(clock.right, undefined)
anchors.leftMargin: root.get(Appearance.padding.large, 0)
anchors.top: root.get(undefined, clock.bottom)
@@ -77,6 +81,16 @@ Item {
anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
}
+
+ StatusIcons {
+ anchors.left: root.get(tray.right, undefined)
+ anchors.leftMargin: root.get(Appearance.padding.normal, 0)
+ anchors.top: root.get(undefined, tray.bottom)
+ anchors.topMargin: root.get(0, Appearance.padding.large)
+
+ anchors.horizontalCenter: root.get(undefined, parent.horizontalCenter)
+ anchors.verticalCenter: root.get(parent.verticalCenter, undefined)
+ }
}
}
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
+ }
+ }
+ }
+}
diff --git a/widgets/StyledText.qml b/widgets/StyledText.qml
index 6f281de..e8fc714 100644
--- a/widgets/StyledText.qml
+++ b/widgets/StyledText.qml
@@ -12,6 +12,7 @@ Text {
renderType: Text.NativeRendering
color: Appearance.colours.text
font.family: Appearance.font.family.sans
+ font.pointSize: Appearance.font.size.smaller
Behavior on color {
ColorAnimation {
diff --git a/widgets/StyledWindow.qml b/widgets/StyledWindow.qml
new file mode 100644
index 0000000..d67bcd2
--- /dev/null
+++ b/widgets/StyledWindow.qml
@@ -0,0 +1,10 @@
+import "root:/utils"
+import "root:/config"
+import Quickshell.Wayland
+
+WlrLayershell {
+ required property string name
+
+ namespace: `caelestia-${name}`
+ color: "transparent"
+}