Share demand counting and jump easing; split Settings sidebar
Add services/Demand.qml, which holds one count on a service's demand counter while active. It replaces 13 hand-written consumer counters across the bar, Control Center, dashboard, media and desktop widgets. The desktop Cava widget now releases Cava while its desktop is covered. Add components/JumpValue.qml for the "animate only visible jumps" rule shared by the dashboard gauge and resource bars. Move the Settings sidebar (search and navigation) into settings/SettingsSidebar.qml and the drag handle into settings/controls/SettingsDragArea.qml, halving Settings.qml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
99e64a7713
commit
bf0ef09cec
18 files changed
+595
-570
No files matched your search
@@ -5,6 +5,7 @@ import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import ".."
|
||||
import "../../widgets/faces" as Faces
|
||||
import "../../components"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
@@ -16,19 +17,14 @@ Item {
|
||||
implicitHeight: row.implicitHeight
|
||||
// Collectors only run while this tab is on screen.
|
||||
readonly property bool live: current
|
||||
property bool subscribed: false
|
||||
onLiveChanged: sync()
|
||||
Component.onCompleted: sync()
|
||||
Component.onDestruction: if (subscribed) {
|
||||
MetricsService.consumers--;
|
||||
MediaService.progressConsumers--;
|
||||
Demand {
|
||||
service: MetricsService
|
||||
active: root.live
|
||||
}
|
||||
function sync() {
|
||||
if (live === subscribed)
|
||||
return;
|
||||
MetricsService.consumers += live ? 1 : -1;
|
||||
MediaService.progressConsumers += live ? 1 : -1;
|
||||
subscribed = live;
|
||||
Demand {
|
||||
service: MediaService
|
||||
counter: "progressConsumers"
|
||||
active: root.live
|
||||
}
|
||||
readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({})
|
||||
|
||||
@@ -215,14 +211,9 @@ Item {
|
||||
property string fallback
|
||||
property string label
|
||||
spacing: 8
|
||||
readonly property real target: Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : 0
|
||||
// Only visible jumps animate (see Gauge).
|
||||
property real shown
|
||||
property bool easeJump: false
|
||||
Component.onCompleted: shown = target
|
||||
onTargetChanged: {
|
||||
easeJump = Math.abs(target - shown) >= 2;
|
||||
shown = target;
|
||||
JumpValue {
|
||||
id: level
|
||||
target: Number.isFinite(bar.value) ? Math.max(0, Math.min(100, bar.value)) : 0
|
||||
}
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -242,16 +233,9 @@ Item {
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: Math.max(parent.width, parent.height * bar.shown / 100)
|
||||
height: Math.max(parent.width, parent.height * level.value / 100)
|
||||
radius: 5
|
||||
color: bar.shown > 85 ? Theme.urgent : Theme.accentVivid
|
||||
Behavior on height {
|
||||
enabled: bar.easeJump
|
||||
NumberAnimation {
|
||||
duration: Theme.duration * 2
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
color: level.target > 85 ? Theme.urgent : Theme.accentVivid
|
||||
}
|
||||
}
|
||||
Text {
|
||||
|
||||
Reference in new issue
Block a user