summaryrefslogtreecommitdiff
path: root/modules/bar/components/workspaces/Workspace.qml
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2026-01-12 12:47:22 -0500
committerFreya Murphy <freya@freyacat.org>2026-03-16 09:34:08 -0400
commit477d4931e49cbc84d6ba5ac9e50fcd7e92182ab4 (patch)
tree349267e6e5805186f1c5e221a22a2de2ed8cb7bb /modules/bar/components/workspaces/Workspace.qml
parentremove default paths (diff)
downloadcaelestia-shell-477d4931e49cbc84d6ba5ac9e50fcd7e92182ab4.tar.gz
caelestia-shell-477d4931e49cbc84d6ba5ac9e50fcd7e92182ab4.tar.bz2
caelestia-shell-477d4931e49cbc84d6ba5ac9e50fcd7e92182ab4.zip
refactor workspace functionality (real per monitor workspaces)
Diffstat (limited to 'modules/bar/components/workspaces/Workspace.qml')
-rw-r--r--modules/bar/components/workspaces/Workspace.qml88
1 files changed, 13 insertions, 75 deletions
diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml
index ec33427..1c1ca74 100644
--- a/modules/bar/components/workspaces/Workspace.qml
+++ b/modules/bar/components/workspaces/Workspace.qml
@@ -11,22 +11,20 @@ ColumnLayout {
required property int index
required property int activeWsId
- required property var occupied
- required property int groupOffset
+ required property var ws
- readonly property bool isWorkspace: true // Flag for finding workspace children
- // Unanimated prop for others to use as reference
- readonly property int size: implicitHeight + (hasWindows ? Appearance.padding.small : 0)
+ readonly property bool isOccupied: ws?.lastIpcObject?.windows > 0
+ readonly property bool isActive: ws?.id == activeWsId
+ readonly property bool isVisible: isActive || isOccupied || true
- readonly property int ws: groupOffset + index + 1
- readonly property bool isOccupied: occupied[ws] ?? false
- readonly property bool hasWindows: isOccupied && Config.bar.workspaces.showWindows
+ // Flag for finding workspace children
+ readonly property bool isWorkspace: true
Layout.alignment: Qt.AlignHCenter
- Layout.preferredHeight: size
+ Layout.preferredHeight: isVisible ? implicitHeight : 0
spacing: 0
- visible: Config.bar.workspaces.occupiedBg || root.isOccupied || root.activeWsId == root.ws
+ visible: isVisible
StyledText {
id: indicator
@@ -36,76 +34,16 @@ ColumnLayout {
animate: true
text: {
- const ws = Hypr.workspaces.values.find(w => w.id === root.ws);
- const wsName = !ws || ws.name == root.ws ? root.ws : ws.name[0];
+ let ws = root.ws;
+ let wsName = !ws || ws.name == ws.id ? ws.id : ws.name[0];
let displayName = wsName.toString();
- if (Config.bar.workspaces.capitalisation.toLowerCase() === "upper") {
- displayName = displayName.toUpperCase();
- } else if (Config.bar.workspaces.capitalisation.toLowerCase() === "lower") {
- displayName = displayName.toLowerCase();
- }
- const label = Config.bar.workspaces.label || displayName;
- const occupiedLabel = Config.bar.workspaces.occupiedLabel || label;
- const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label);
- return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label;
+ let label = Config.bar.workspaces.label || displayName;
+ return label
}
- color: Config.bar.workspaces.occupiedBg || root.isOccupied || root.activeWsId === root.ws ? Colours.palette.m3onSurface : Colours.layer(Colours.palette.m3outlineVariant, 2)
+ color: root.isActive ? Colours.palette.m3onSurface : Colours.layer(Colours.palette.m3outlineVariant, 2)
verticalAlignment: Qt.AlignVCenter
}
- Loader {
- id: windows
-
- Layout.alignment: Qt.AlignHCenter
- Layout.fillHeight: true
- Layout.topMargin: -Config.bar.sizes.innerWidth / 10
-
- visible: active
- active: root.hasWindows
-
- sourceComponent: Column {
- spacing: 0
-
- add: Transition {
- Anim {
- properties: "scale"
- from: 0
- to: 1
- easing.bezierCurve: Appearance.anim.curves.standardDecel
- }
- }
-
- move: Transition {
- Anim {
- properties: "scale"
- to: 1
- easing.bezierCurve: Appearance.anim.curves.standardDecel
- }
- Anim {
- properties: "x,y"
- }
- }
-
- Repeater {
- model: ScriptModel {
- values: {
- const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === root.ws);
- const maxIcons = Config.bar.workspaces.maxWindowIcons;
- return maxIcons > 0 ? windows.slice(0, maxIcons) : windows;
- }
- }
-
- MaterialIcon {
- required property var modelData
-
- grade: 0
- text: Icons.getAppCategoryIcon(modelData.lastIpcObject.class, "terminal")
- color: Colours.palette.m3onSurfaceVariant
- }
- }
- }
- }
-
Behavior on Layout.preferredHeight {
Anim {}
}