diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-27 22:52:30 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-27 22:52:30 +0800 |
| commit | ce8e149258341e303beca4e178c6e4a9cc257806 (patch) | |
| tree | 8a6206f6312a21aa002f1edc9f53500613dafaa3 | |
| parent | 85b22b4c5ee923ea3db40a60e0b421a980375508 (diff) | |
Revert "ws: automatically update root.activeOccupied instead of manually"
This reverts commit 85b22b4c5ee923ea3db40a60e0b421a980375508.
| -rw-r--r-- | bar/Workspace.qml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bar/Workspace.qml b/bar/Workspace.qml index a72c664..ee6810b 100644 --- a/bar/Workspace.qml +++ b/bar/Workspace.qml @@ -98,19 +98,18 @@ Item { IRect { property var st: getWorkspaceStats(index) property bool active: st?.isActive || false - property bool occupied: st?.isOccupied || false implicitWidth: active ? Bar.wsActiveIconSize : Bar.wsIconSize implicitHeight: Bar.wsIconSize - Bar.wsHorizontalSpacing radius: Bar.wsRounding - color: occupied ? Colors.d2 : Colors.foreground1 - opacity: active && occupied ? Bar.wsActiveOpacity : st.isOccupied ? Bar.wsOpacity : Bar.wsEmptyOpacity + color: st.isOccupied ? Colors.d2 : Colors.foreground1 + opacity: active && st.isOccupied ? Bar.wsActiveOpacity : st.isOccupied ? Bar.wsOpacity : Bar.wsEmptyOpacity Icon { anchors.centerIn: parent text: !st.isUrgent ? Icons.ws[index + 1] : Icons.ws['urgent'] font.pixelSize: !active ? Bar.wsIconSize / 2 : Bar.wsActiveIconSize / 2.5 - opacity: !occupied ? 0 : 1 + opacity: !st.isOccupied ? 0 : 1 color: !st.isUrgent ? !st.isActive ? Colors.foreground2 : Colors.foreground1 : Colors.red Behavior on font.pixelSize { ISpringAnimation {} @@ -139,6 +138,7 @@ Item { } function moveActive() { activeRect.x = parent.x; + root.activeOccupied = st.isOccupied || false; activeRect.implicitWidth = active ? Bar.wsActiveIconSize : Bar.wsIconSize; } onEntered: { @@ -156,7 +156,7 @@ Item { // // just in case // activeRect.x = layout.x + previousActiveIndex * Bar.wsIconSize + previousActiveIndex * Bar.wsSpacing; // activeRect.implicitWidth = Bar.wsActiveIconSize; - // // root.activeOccupied = parent.occupied || false; + // // root.activeOccupied = parent.st.isOccupied || false; // root.activeOccupied = getWorkspaceStats(previousActiveIndex).isOccupied || false; // previousActiveIndex = -1; // } @@ -199,12 +199,10 @@ Item { onActiveChanged: if (active) { root.activeIndex = index; + root.activeOccupied = st.isOccupied; activeRect.implicitWidth = Bar.wsActiveIconSize; activeRect.x = activeRectX; } - onOccupiedChanged: { - root.activeOccupied = occupied; - } } } } @@ -220,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: { @@ -227,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 => { |
