quickshell: server glance under workspaces, sliders get knobs

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-07-28 16:08:45 +01:00
parent 36e9b00782
commit ce14f695c6

View file

@ -772,14 +772,17 @@ in
}
}
// PillSlider: slim rounded track + fill with a full-height
// PillSlider: rounded track + fill + knob with a full-height
// invisible hit area. `value` is 0..1; `moved(v)` fires on drag.
// Knob diameter derives from the track, so the small app-stream
// variants scale with just a trackH override.
component PillSlider: Item {
property real value: 0
property color fillColor: Theme.base0D
property real trackH: 6
property real trackH: 8
readonly property real knobD: trackH + 8
signal moved(real v)
height: 20
height: 22
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: parent.width
@ -795,6 +798,15 @@ in
color: parent.fillColor
Behavior on width { NumberAnimation { duration: 80 } }
}
Rectangle {
width: parent.knobD
height: parent.knobD
radius: parent.knobD / 2
anchors.verticalCenter: parent.verticalCenter
x: Math.max(0, Math.min(parent.width - parent.knobD, parent.value * parent.width - parent.knobD / 2))
color: Theme.base06
Behavior on x { NumberAnimation { duration: 80 } }
}
MouseArea {
anchors.fill: parent
function set(mouse) { parent.moved(Math.max(0, Math.min(1, mouse.x / width))); }
@ -1458,22 +1470,11 @@ in
}
}
}
}
// Bottom cluster: status icons, tray, power button. Anchored
// to the bottom edge so the gap above it between here and the
// workspace dots stays free as the OSD slot.
Column {
id: barBottom
anchors.bottom: parent.bottom
anchors.bottomMargin: 12
anchors.horizontalCenter: barBgRect.horizontalCenter
spacing: 16
// Server monitor: one persistent SSH streaming `top -b`
// from the mediaserver (2s ticks, parsed line by line
// no per-poll reconnects) plus a streaming ping to the
// router. Glance = CPU/RAM mini meters + ping ms; click
// router. Glance = CPU/RAM numbers + ping ms; click
// opens the btop-style dropdown.
Item {
id: srvWidget
@ -1612,6 +1613,17 @@ in
}
}
}
}
// Bottom cluster: status icons, tray, power button. Anchored
// to the bottom edge so the gap above it between here and the
// workspace dots stays free as the OSD slot.
Column {
id: barBottom
anchors.bottom: parent.bottom
anchors.bottomMargin: 12
anchors.horizontalCenter: barBgRect.horizontalCenter
spacing: 16
// Volume
Item {
@ -2532,7 +2544,6 @@ in
SText { width: 42; text: "cpu"; color: Theme.base04; anchors.verticalCenter: parent.verticalCenter }
PillSlider {
width: parent.width - 42 - 76 - 20
height: 22; trackH: 6
anchors.verticalCenter: parent.verticalCenter
value: srvWidget.cpu / 100
fillColor: srvWidget.cpu >= 90 ? Theme.base08 : Theme.base0D
@ -2552,7 +2563,6 @@ in
SText { width: 42; text: "ram"; color: Theme.base04; anchors.verticalCenter: parent.verticalCenter }
PillSlider {
width: parent.width - 42 - 76 - 20
height: 22; trackH: 6
anchors.verticalCenter: parent.verticalCenter
value: srvWidget.memTotal > 0 ? srvWidget.memUsed / srvWidget.memTotal : 0
fillColor: Theme.base0C