summaryrefslogtreecommitdiff
path: root/modules/bar/components/workspaces/OccupiedBg.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-29 09:38:23 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-29 09:38:23 +1000
commit46e1127b66a435dc4ba4b8e3ce57715da24b7743 (patch)
treef0451a122d6234240e5688110f1b03133423352f /modules/bar/components/workspaces/OccupiedBg.qml
parentrefactor: appearance fix typing (diff)
downloadcaelestia-shell-46e1127b66a435dc4ba4b8e3ce57715da24b7743.tar.gz
caelestia-shell-46e1127b66a435dc4ba4b8e3ce57715da24b7743.tar.bz2
caelestia-shell-46e1127b66a435dc4ba4b8e3ce57715da24b7743.zip
refactor: move bar components into folder
Diffstat (limited to 'modules/bar/components/workspaces/OccupiedBg.qml')
-rw-r--r--modules/bar/components/workspaces/OccupiedBg.qml48
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/bar/components/workspaces/OccupiedBg.qml b/modules/bar/components/workspaces/OccupiedBg.qml
new file mode 100644
index 0000000..97a27a0
--- /dev/null
+++ b/modules/bar/components/workspaces/OccupiedBg.qml
@@ -0,0 +1,48 @@
+import "root:/widgets"
+import "root:/services"
+import "root:/config"
+import QtQuick
+import QtQuick.Layouts
+import Qt5Compat.GraphicalEffects
+
+BoxLayout {
+ id: root
+
+ required property bool vertical
+ required property list<Label> workspaces
+ required property var occupied
+ required property BoxLayout layout
+
+ anchors.centerIn: parent
+ spacing: 0
+ z: -1
+
+ Repeater {
+ model: BarConfig.workspaces.shown
+
+ Rectangle {
+ required property int index
+ readonly property int roundLeft: index === 0 || !root.occupied[index] ? Appearance.rounding.full : 0
+ readonly property int roundRight: index === BarConfig.workspaces.shown - 1 || !root.occupied[index + 2] ? Appearance.rounding.full : 0
+
+ color: Appearance.alpha(Appearance.colours.surface2, true)
+ opacity: root.occupied[index + 1] ? 1 : 0
+ topLeftRadius: roundLeft
+ bottomLeftRadius: roundLeft
+ topRightRadius: roundRight
+ bottomRightRadius: roundRight
+
+ // Ugh stupid size errors on reload
+ Layout.preferredWidth: root.vertical ? layout.width : root.workspaces[index]?.width ?? 1
+ Layout.preferredHeight: root.vertical ? root.workspaces[index]?.height ?? 1 : layout.height
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
+ }
+ }
+ }
+}