summaryrefslogtreecommitdiff
path: root/modules/bar
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-28 19:54:47 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-28 19:54:47 +1000
commit3108a7d75e39261bdfb9aec691ddbb5c498f6194 (patch)
treeb06999c4f5b8e5071b14eff531e2d05519a085ec /modules/bar
parentbar: workspaces show occupied (diff)
downloadcaelestia-shell-3108a7d75e39261bdfb9aec691ddbb5c498f6194.tar.gz
caelestia-shell-3108a7d75e39261bdfb9aec691ddbb5c498f6194.tar.bz2
caelestia-shell-3108a7d75e39261bdfb9aec691ddbb5c498f6194.zip
bar: workspaces different styles for occupied
Diffstat (limited to 'modules/bar')
-rw-r--r--modules/bar/Bar.qml1
-rw-r--r--modules/bar/workspaces/OccupiedBg.qml52
-rw-r--r--modules/bar/workspaces/Workspaces.qml (renamed from modules/bar/Workspaces.qml)67
3 files changed, 71 insertions, 49 deletions
diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml
index 776d249..aa9766d 100644
--- a/modules/bar/Bar.qml
+++ b/modules/bar/Bar.qml
@@ -1,5 +1,6 @@
import "root:/widgets"
import "root:/config"
+import "workspaces"
import Quickshell
import Quickshell.Wayland
import QtQuick
diff --git a/modules/bar/workspaces/OccupiedBg.qml b/modules/bar/workspaces/OccupiedBg.qml
new file mode 100644
index 0000000..b9846b6
--- /dev/null
+++ b/modules/bar/workspaces/OccupiedBg.qml
@@ -0,0 +1,52 @@
+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 BoxLayout layout
+
+ readonly property var occupied: Hyprland.workspaces.values.reduce((acc, curr) => {
+ acc[curr.id] = curr.lastIpcObject.windows > 0;
+ return acc;
+ }, {})
+
+ 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
+ }
+ }
+ }
+ }
+}
diff --git a/modules/bar/Workspaces.qml b/modules/bar/workspaces/Workspaces.qml
index d7dc2fb..203ef91 100644
--- a/modules/bar/Workspaces.qml
+++ b/modules/bar/workspaces/Workspaces.qml
@@ -33,7 +33,7 @@ Item {
readonly property bool isWorkspace: true
text: index + 1
- color: Appearance.colours.text
+ color: BarConfig.workspaces.occupiedBg || occupied.occupied[index + 1] ? Appearance.colours.text : Appearance.colours.subtext0
horizontalAlignment: Label.AlignHCenter
Layout.preferredWidth: layout.homogenous && !layout.vertical ? layout.height : -1
@@ -42,44 +42,17 @@ Item {
}
}
- BoxLayout {
+ OccupiedBg {
id: occupied
- readonly property var occupied: Hyprland.workspaces.values.reduce((acc, curr) => {
- acc[curr.id] = curr.lastIpcObject.windows > 0;
- return acc;
- }, {})
-
- anchors.centerIn: parent
- spacing: 0
- z: -1
-
- Repeater {
- model: BarConfig.workspaces.shown
+ opacity: BarConfig.workspaces.occupiedBg ? 1 : 0
+ vertical: root.vertical
+ workspaces: root.workspaces
+ layout: layout
- Rectangle {
- required property int index
- readonly property int roundLeft: index === 0 || !occupied.occupied[index] ? Appearance.rounding.full : 0
- readonly property int roundRight: index === BarConfig.workspaces.shown - 1 || !occupied.occupied[index + 2] ? Appearance.rounding.full : 0
-
- color: Appearance.alpha(Appearance.colours.surface2, true)
- opacity: occupied.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
- }
- }
+ Behavior on opacity {
+ Anim {
+ easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
@@ -143,27 +116,23 @@ Item {
}
Behavior on leading {
- NumberAnimation {
- duration: Appearance.anim.durations.normal
- easing.type: Easing.BezierSpline
- easing.bezierCurve: Appearance.anim.curves.emphasized
- }
+ Anim {}
}
Behavior on trailing {
- NumberAnimation {
+ Anim {
duration: Appearance.anim.durations.normal * 2
- easing.type: Easing.BezierSpline
- easing.bezierCurve: Appearance.anim.curves.emphasized
}
}
Behavior on currentSize {
- NumberAnimation {
- duration: Appearance.anim.durations.normal
- easing.type: Easing.BezierSpline
- easing.bezierCurve: Appearance.anim.curves.emphasized
- }
+ Anim {}
}
}
+
+ component Anim: NumberAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.emphasized
+ }
}