diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-14 19:15:41 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-14 19:15:41 +0800 |
| commit | 794df70385ca2d5d8773c32d6a5d45e61b730363 (patch) | |
| tree | 82716302a987eff0fb6e8d6ef44ae1dc960eda87 | |
| parent | ad8321b322ce9d7192f9a85ec5d3b4d2bc91574f (diff) | |
Revert "timedate: use 12hr"
This reverts commit a521a82030cdf0a89a62250b429209992f948824.
| -rw-r--r-- | bar/Workspace.qml | 94 |
1 files changed, 17 insertions, 77 deletions
diff --git a/bar/Workspace.qml b/bar/Workspace.qml index e545b24..ccfcd57 100644 --- a/bar/Workspace.qml +++ b/bar/Workspace.qml @@ -8,45 +8,29 @@ import qs.components Item { id: root + + // required property ShellScreen screen // multi monitor property var ws: Hyprland.workspaces + + // readonly property HyprlandMonitor monitor: Hyprland.monitorFor(screen) // multi monitor + // dont work no more for some reason + function getWorkspaceStats(index) { const w = ws.values.find(i => i.id === index + 1); return { - isOccupied: Boolean(w?.toplevels?.values?.length), - isActive: Boolean(w?.active), - isUrgent: Boolean(w?.urgent) + isOccupied: w?.toplevels?.values?.length, + isActive: w?.active, + isUrgent: w?.urgent }; } - implicitWidth: layout.implicitWidth - property int activeIndex: 0 - property int prevIndex: 0 - Rectangle { - id: activeRect - anchors.verticalCenter: parent.verticalCenter - height: Bar.workspaceIconSize - Bar.workspaceHorizontalSpacing - width: Bar.workspaceIconSize - radius: Bar.workspaceRounding - color: Colors.alt - opacity: Bar.workspaceActiveOpacity - Behavior on x { - NumberAnimation { - duration: Bar.workspaceAnimationTransition - easing.type: Easing.OutQuad - } - } - Behavior on width { - NumberAnimation { - duration: Bar.workspaceAnimationExpand - easing.type: Easing.OutQuad - } - } - } + implicitWidth: layout.implicitWidth RowLayout { id: layout implicitWidth: childrenRect.width anchors.verticalCenter: parent.verticalCenter + spacing: Bar.workspaceSpacing Repeater { @@ -55,65 +39,21 @@ Item { Rectangle { id: workspaceRect property var st: getWorkspaceStats(index) - property bool active: st.isActive - property bool shouldExpand: false - implicitWidth: shouldExpand ? Bar.workspaceActiveIconSize : Bar.workspaceIconSize + implicitWidth: !st.isActive ? Bar.workspaceIconSize : Bar.workspaceActiveIconSize implicitHeight: Bar.workspaceIconSize - Bar.workspaceHorizontalSpacing radius: Bar.workspaceRounding - - Behavior on implicitWidth { - NumberAnimation { - duration: shouldExpand ? Bar.workspaceAnimationExpand : Bar.workspaceAnimationShrink - easing.type: Easing.OutQuad - } - } - - SequentialAnimation { - id: activeRectAnimation - PauseAnimation { - duration: Bar.workspaceAnimationTransition - } - ScriptAction { - script: { - activeRect.x = workspaceRect.x; - activeRect.width = Bar.workspaceActiveIconSize; - workspaceRect.shouldExpand = true; - } - } - } - - Component.onCompleted: { - if (active) { - root.activeIndex = index; - root.prevIndex = index; - shouldExpand = true; - activeRect.x = x; - activeRect.width = Bar.workspaceActiveIconSize; - } - } - - onActiveChanged: { - if (active) { - root.prevIndex = root.activeIndex; - root.activeIndex = index; - activeRect.width = Bar.workspaceIconSize; - layout.children[root.prevIndex].shouldExpand = false; - activeRect.x = layout.children[root.prevIndex].x; - activeRectAnimation.start(); - } - } - Icon { anchors.centerIn: parent - text: !st.isUrgent ? Icons.ws[index + 1] : Icons.ws['urgent'] + text: !st.isUrgent ? Icons.ws[index + 1] : Icons.ws['urgent'] // TODO: urgent = red font.pixelSize: Bar.workspaceIconSize / 2 - color: Colors.foreground - opacity: st.isOccupied ? 1 : 0 + color: Colors.foreground // TODO make IText w/ ts default color + opacity: !st.isOccupied ? 0 : 1 // less contrast + // opacity: isActive(index) ? Bar.workspaceActiveOpacity : isOccupied(index) ? Bar.workspaceOpacity : Bar.workspaceEmptyOpacity } color: st.isOccupied ? Colors.alt : Colors.foreground - opacity: st.isOccupied ? Bar.workspaceOpacity : Bar.workspaceEmptyOpacity + opacity: st.isActive && st.isOccupied ? Bar.workspaceActiveOpacity : st.isOccupied ? Bar.workspaceOpacity : Bar.workspaceEmptyOpacity } } } |
