quickshell: server monitor sizing, glance matches clock, bigger card type

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-07-28 15:58:06 +01:00
parent 39b88591e8
commit 36e9b00782

View file

@ -1478,7 +1478,7 @@ in
Item { Item {
id: srvWidget id: srvWidget
width: Theme.barWidth width: Theme.barWidth
height: 42 height: srvGlanceCol.height
property bool connected: false property bool connected: false
property real cpu: 0 property real cpu: 0
@ -1569,21 +1569,25 @@ in
// Numbers, colour-coded instead of labelled: // Numbers, colour-coded instead of labelled:
// blue = cpu%, cyan = ram%, grey = ping ms. // blue = cpu%, cyan = ram%, grey = ping ms.
// Same 15px Medium as the clock above.
Column { Column {
id: srvGlanceCol
anchors.centerIn: parent anchors.centerIn: parent
spacing: 2 spacing: 0
SText { SText {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: srvWidget.connected ? Math.round(srvWidget.cpu) + "%" : "--" text: srvWidget.connected ? Math.round(srvWidget.cpu) + "%" : "--"
font.pixelSize: 9 font.pixelSize: 15
font.weight: Font.Medium
color: srvWidget.connected ? Theme.base0D : Theme.base03 color: srvWidget.connected ? Theme.base0D : Theme.base03
} }
SText { SText {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: srvWidget.connected && srvWidget.memTotal > 0 text: srvWidget.connected && srvWidget.memTotal > 0
? Math.round(100 * srvWidget.memUsed / srvWidget.memTotal) + "%" : "--" ? Math.round(100 * srvWidget.memUsed / srvWidget.memTotal) + "%" : "--"
font.pixelSize: 9 font.pixelSize: 15
font.weight: Font.Medium
color: srvWidget.connected ? Theme.base0C : Theme.base03 color: srvWidget.connected ? Theme.base0C : Theme.base03
} }
SText { SText {
@ -1591,7 +1595,8 @@ in
text: srvWidget.pingMs < 0 ? "--" text: srvWidget.pingMs < 0 ? "--"
: srvWidget.pingMs < 10 ? srvWidget.pingMs.toFixed(1) : srvWidget.pingMs < 10 ? srvWidget.pingMs.toFixed(1)
: Math.round(srvWidget.pingMs).toString() : Math.round(srvWidget.pingMs).toString()
font.pixelSize: 9 font.pixelSize: 15
font.weight: Font.Medium
color: srvWidget.pingMs < 0 ? Theme.base03 : Theme.base04 color: srvWidget.pingMs < 0 ? Theme.base03 : Theme.base04
} }
} }
@ -2491,7 +2496,7 @@ in
Column { Column {
id: srvDropdownCol id: srvDropdownCol
anchors.centerIn: parent anchors.centerIn: parent
width: 300 width: 340
spacing: 8 spacing: 8
Card { Card {
@ -2516,26 +2521,26 @@ in
text: srvWidget.connected text: srvWidget.connected
? "up " + srvWidget.uptime + " load " + srvWidget.load ? "up " + srvWidget.uptime + " load " + srvWidget.load
: "unreachable" : "unreachable"
font.pixelSize: 10 font.pixelSize: 12
color: srvWidget.connected ? Theme.base04 : Theme.base08 color: srvWidget.connected ? Theme.base04 : Theme.base08
elide: Text.ElideRight elide: Text.ElideRight
} }
Row { Row {
width: parent.width width: parent.width
spacing: 8 spacing: 10
SText { width: 32; text: "cpu"; font.pixelSize: 11; color: Theme.base04; anchors.verticalCenter: parent.verticalCenter } SText { width: 42; text: "cpu"; color: Theme.base04; anchors.verticalCenter: parent.verticalCenter }
PillSlider { PillSlider {
width: parent.width - 32 - 64 - 16 width: parent.width - 42 - 76 - 20
height: 16; trackH: 4 height: 22; trackH: 6
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
value: srvWidget.cpu / 100 value: srvWidget.cpu / 100
fillColor: srvWidget.cpu >= 90 ? Theme.base08 : Theme.base0D fillColor: srvWidget.cpu >= 90 ? Theme.base08 : Theme.base0D
} }
SText { SText {
width: 64 width: 76
text: srvWidget.cpu.toFixed(1) + "%" text: srvWidget.cpu.toFixed(1) + "%"
font.pixelSize: 11 font.weight: Font.Medium
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@ -2543,19 +2548,19 @@ in
Row { Row {
width: parent.width width: parent.width
spacing: 8 spacing: 10
SText { width: 32; text: "ram"; font.pixelSize: 11; color: Theme.base04; anchors.verticalCenter: parent.verticalCenter } SText { width: 42; text: "ram"; color: Theme.base04; anchors.verticalCenter: parent.verticalCenter }
PillSlider { PillSlider {
width: parent.width - 32 - 64 - 16 width: parent.width - 42 - 76 - 20
height: 16; trackH: 4 height: 22; trackH: 6
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
value: srvWidget.memTotal > 0 ? srvWidget.memUsed / srvWidget.memTotal : 0 value: srvWidget.memTotal > 0 ? srvWidget.memUsed / srvWidget.memTotal : 0
fillColor: Theme.base0C fillColor: Theme.base0C
} }
SText { SText {
width: 64 width: 76
text: srvWidget.memUsed.toFixed(1) + "/" + Math.round(srvWidget.memTotal) + "G" text: srvWidget.memUsed.toFixed(1) + "/" + Math.round(srvWidget.memTotal) + "G"
font.pixelSize: 11 font.weight: Font.Medium
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@ -2563,11 +2568,11 @@ in
Row { Row {
width: parent.width width: parent.width
spacing: 8 spacing: 10
SText { width: 32; text: "ping"; font.pixelSize: 11; color: Theme.base04 } SText { width: 42; text: "ping"; color: Theme.base04 }
SText { SText {
text: srvWidget.pingMs < 0 ? "--" : srvWidget.pingMs.toFixed(1) + " ms" text: srvWidget.pingMs < 0 ? "--" : srvWidget.pingMs.toFixed(1) + " ms"
font.pixelSize: 11 font.weight: Font.Medium
color: srvWidget.pingMs < 0 ? Theme.base03 : Theme.base05 color: srvWidget.pingMs < 0 ? Theme.base03 : Theme.base05
} }
} }
@ -2588,14 +2593,14 @@ in
Row { Row {
width: parent.width width: parent.width
SText { width: parent.width - 88; text: "name"; font.pixelSize: 10; color: Theme.base03 } SText { width: parent.width - 112; text: "name"; font.pixelSize: 11; color: Theme.base03 }
SText { width: 44; text: "cpu%"; font.pixelSize: 10; color: Theme.base03; horizontalAlignment: Text.AlignRight } SText { width: 56; text: "cpu%"; font.pixelSize: 11; color: Theme.base03; horizontalAlignment: Text.AlignRight }
SText { width: 44; text: "mem%"; font.pixelSize: 10; color: Theme.base03; horizontalAlignment: Text.AlignRight } SText { width: 56; text: "mem%"; font.pixelSize: 11; color: Theme.base03; horizontalAlignment: Text.AlignRight }
} }
Column { Column {
width: parent.width width: parent.width
spacing: 2 spacing: 3
Repeater { Repeater {
model: srvWidget.procs model: srvWidget.procs
@ -2603,27 +2608,24 @@ in
Row { Row {
required property var modelData required property var modelData
width: parent.width width: parent.width
height: 17 height: 21
SText { SText {
width: parent.width - 88 width: parent.width - 112
text: modelData.name text: modelData.name
font.pixelSize: 11
elide: Text.ElideRight elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
SText { SText {
width: 44 width: 56
text: modelData.cpu.toFixed(1) text: modelData.cpu.toFixed(1)
font.pixelSize: 11
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
color: modelData.cpu >= 100 ? Theme.base08 color: modelData.cpu >= 100 ? Theme.base08
: modelData.cpu >= 25 ? Theme.base0A : Theme.base05 : modelData.cpu >= 25 ? Theme.base0A : Theme.base05
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
SText { SText {
width: 44 width: 56
text: modelData.mem.toFixed(1) text: modelData.mem.toFixed(1)
font.pixelSize: 11
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
color: Theme.base04 color: Theme.base04
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -2634,7 +2636,6 @@ in
SText { SText {
visible: srvWidget.procs.length === 0 visible: srvWidget.procs.length === 0
text: "no data" text: "no data"
font.pixelSize: 11
color: Theme.base03 color: Theme.base03
} }
} }