summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-27 23:50:33 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-27 23:51:12 +0800
commit2a0b49a58454a91cd4ad695643757dc4e80dfb0c (patch)
tree8a6206f6312a21aa002f1edc9f53500613dafaa3
parent8b3b5408d544e85ee1f5570853ab89e0265052a4 (diff)
Revert "ws: dynamically fetch ws occupied status for activerect"
This reverts commit 1a1846e43eec41d1f40c04ea9bd6dd873b6e630a. doesn't work, random race condition :/
-rw-r--r--bar/Workspace.qml13
1 files changed, 9 insertions, 4 deletions
diff --git a/bar/Workspace.qml b/bar/Workspace.qml
index 1520362..ee6810b 100644
--- a/bar/Workspace.qml
+++ b/bar/Workspace.qml
@@ -14,6 +14,7 @@ Item {
property var ws: Hyprland.workspaces
property int activeIndex: -1
+ property bool activeOccupied: false
property bool toChild: false
property real activeRectX: {
@@ -36,8 +37,8 @@ Item {
source: activeRect
radius: 8
cached: true
- color: getWorkspaceStats(activeIndex).isOccupied ? Colors.d2 : Colors.foreground1
- opacity: getWorkspaceStats(activeIndex).isOccupied ? Bar.wsActiveOpacity : Bar.wsEmptyOpacity / 3
+ color: root.activeOccupied ? Colors.d2 : Colors.foreground1
+ opacity: root.activeOccupied ? Bar.wsActiveOpacity : Bar.wsEmptyOpacity / 3
Behavior on color {
NumberAnimation {
@@ -59,8 +60,8 @@ Item {
implicitWidth: Bar.wsActiveIconSize
implicitHeight: Bar.wsIconSize - Bar.wsHorizontalSpacing
radius: Bar.wsRounding
- color: getWorkspaceStats(activeIndex).isOccupied ? Colors.d2 : Colors.foreground1
- opacity: getWorkspaceStats(activeIndex).isOccupied ? Bar.wsActiveOpacity : Bar.wsEmptyOpacity / 3
+ color: root.activeOccupied ? Colors.d2 : Colors.foreground1
+ opacity: root.activeOccupied ? Bar.wsActiveOpacity : Bar.wsEmptyOpacity / 3
Behavior on x {
ISpringAnimation {}
}
@@ -137,6 +138,7 @@ Item {
}
function moveActive() {
activeRect.x = parent.x;
+ root.activeOccupied = st.isOccupied || false;
activeRect.implicitWidth = active ? Bar.wsActiveIconSize : Bar.wsIconSize;
}
onEntered: {
@@ -197,6 +199,7 @@ Item {
onActiveChanged: if (active) {
root.activeIndex = index;
+ root.activeOccupied = st.isOccupied;
activeRect.implicitWidth = Bar.wsActiveIconSize;
activeRect.x = activeRectX;
}
@@ -215,6 +218,7 @@ Item {
onPositionChanged: {
const abovedItemIndex = Math.round((mouseX - layout.x) / (Bar.wsIconSize + Bar.wsSpacing)) - 1; // TODO: workspaceActiveIconSize might be before
activeRect.x = mouseX - activeRect.width / 2;
+ root.activeOccupied = getWorkspaceStats(abovedItemIndex).isOccupied || false;
activeRect.implicitWidth = root.activeIndex === abovedItemIndex ? Bar.wsActiveIconSize : Bar.wsIconSize;
}
onExited: {
@@ -222,6 +226,7 @@ Item {
// just in case
activeRect.x = layout.x + root.activeIndex * Bar.wsIconSize + root.activeIndex * Bar.wsSpacing;
activeRect.implicitWidth = Bar.wsActiveIconSize;
+ root.activeOccupied = getWorkspaceStats(root.activeIndex).isOccupied || false;
}
}
onWheel: event => {