fix: redesign Sensors & Network plasmoid block for spacing, theme palette alignment, and Wi-Fi signal percentage

This commit is contained in:
Sho 2026-08-02 14:13:43 +09:00
parent 99c8d8c07f
commit 9f42bd9fc5
3 changed files with 85 additions and 18 deletions

View File

@ -267,10 +267,10 @@ PanelWindow {
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: 12 anchors.margins: 12
spacing: 4 spacing: 6
Text { Text {
text: "🌡️ Sensors & Net" text: "🌡️ Sensors & Network"
color: Theme.fg color: Theme.fg
font.pixelSize: 12 font.pixelSize: 12
font.weight: Font.Bold font.weight: Font.Bold
@ -278,21 +278,69 @@ PanelWindow {
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Text { text: "💾 NVMe: " + SystemMonitorService.nvmeTemp + "°C"; color: Theme.cyan; font.pixelSize: 10; font.weight: Font.Bold } spacing: 4
RowLayout {
spacing: 4
Text { text: "💾 NVMe:"; color: Theme.comment; font.pixelSize: 10; font.weight: Font.Bold }
Text { text: SystemMonitorService.nvmeTemp + "°C"; color: Theme.cyan; font.pixelSize: 10; font.weight: Font.Bold }
}
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }
Text { text: "📶 Wi-Fi: " + SystemMonitorService.wifiTemp + "°C"; color: Theme.yellow; font.pixelSize: 10; font.weight: Font.Bold }
RowLayout {
spacing: 4
Text { text: "📶 Wi-Fi:"; color: Theme.comment; font.pixelSize: 10; font.weight: Font.Bold }
Text { text: SystemMonitorService.wifiSignal; color: Theme.subAccent; font.pixelSize: 10; font.weight: Font.Bold }
}
} }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Text { text: "⬇ " + SystemMonitorService.netRx; color: Theme.green; font.pixelSize: 10; font.weight: Font.Bold } spacing: 4
Item { Layout.fillWidth: true }
Text { text: "⬆ " + SystemMonitorService.netTx; color: Theme.subAccent; font.pixelSize: 10; font.weight: Font.Bold } RowLayout {
spacing: 4
Text { text: "⬇ Net:"; color: Theme.comment; font.pixelSize: 10; font.weight: Font.Bold }
Text { text: SystemMonitorService.netRx; color: Theme.green; font.pixelSize: 10; font.weight: Font.Bold }
} }
Text { text: "🔥 " + SystemMonitorService.topProc + " (" + SystemMonitorService.procCount + " procs)"; color: Theme.pink; font.pixelSize: 10 } Item { Layout.fillWidth: true }
RowLayout {
spacing: 4
Text { text: "⬆ Up:"; color: Theme.comment; font.pixelSize: 10; font.weight: Font.Bold }
Text { text: SystemMonitorService.netTx; color: Theme.purple; font.pixelSize: 10; font.weight: Font.Bold }
}
}
RowLayout {
Layout.fillWidth: true
spacing: 4
Text { text: "🔥 Top:"; color: Theme.comment; font.pixelSize: 10; font.weight: Font.Bold }
Text {
text: SystemMonitorService.topProc + " (" + SystemMonitorService.procCount + " procs)"
color: Theme.pink
font.pixelSize: 10
elide: Text.ElideRight
Layout.fillWidth: true
}
}
Item { Layout.fillHeight: true }
// Storage Gauge Bar
ColumnLayout {
Layout.fillWidth: true
spacing: 3
RowLayout {
Layout.fillWidth: true
Text { text: "Storage"; color: Theme.comment; font.pixelSize: 9 }
Item { Layout.fillWidth: true }
Text { text: SystemMonitorService.diskUsed + " / " + SystemMonitorService.diskTotal + " GB (" + SystemMonitorService.diskPct + "%)"; color: Theme.yellow; font.pixelSize: 9 }
}
// Disk Usage Gauge Bar
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
height: 6 height: 6
@ -303,7 +351,7 @@ PanelWindow {
height: parent.height height: parent.height
width: parent.width * (SystemMonitorService.diskPct / 100.0) width: parent.width * (SystemMonitorService.diskPct / 100.0)
radius: 3 radius: 3
color: Theme.yellow color: Theme.accent
Behavior on width { NumberAnimation { duration: 300 } } Behavior on width { NumberAnimation { duration: 300 } }
} }
} }
@ -311,4 +359,5 @@ PanelWindow {
} }
} }
} }
}
} }

View File

@ -23,6 +23,7 @@ Item {
property real nvmeTemp: 0.0 property real nvmeTemp: 0.0
property real wifiTemp: 0.0 property real wifiTemp: 0.0
property string wifiSignal: "100%"
property real ramUsed: 0.0 property real ramUsed: 0.0
property real ramTotal: 30.6 property real ramTotal: 30.6
@ -69,6 +70,7 @@ Item {
if (parsed.nvme_temp !== undefined) root.nvmeTemp = parsed.nvme_temp if (parsed.nvme_temp !== undefined) root.nvmeTemp = parsed.nvme_temp
if (parsed.wifi_temp !== undefined) root.wifiTemp = parsed.wifi_temp if (parsed.wifi_temp !== undefined) root.wifiTemp = parsed.wifi_temp
if (parsed.wifi_signal !== undefined) root.wifiSignal = parsed.wifi_signal
if (parsed.ram_used !== undefined) root.ramUsed = parsed.ram_used if (parsed.ram_used !== undefined) root.ramUsed = parsed.ram_used
if (parsed.ram_total !== undefined) root.ramTotal = parsed.ram_total if (parsed.ram_total !== undefined) root.ramTotal = parsed.ram_total

View File

@ -118,6 +118,20 @@ def get_top_process_and_count():
pass pass
return top_proc, proc_count return top_proc, proc_count
def get_wifi_signal():
try:
if os.path.exists('/proc/net/wireless'):
with open('/proc/net/wireless', 'r') as f:
lines = f.readlines()
if len(lines) > 2:
parts = lines[2].split()
link_quality = float(parts[2].rstrip('.'))
pct = min(100, int((link_quality / 70.0) * 100))
return f"{pct}%"
except Exception:
pass
return "100%"
def get_hardware_metrics(): def get_hardware_metrics():
hw = { hw = {
"cpu_temp": 0.0, "cpu_temp": 0.0,
@ -129,7 +143,8 @@ def get_hardware_metrics():
"gpu_power": "20W / 78W", "gpu_power": "20W / 78W",
"gpu_fan": 0, "gpu_fan": 0,
"nvme_temp": 0.0, "nvme_temp": 0.0,
"wifi_temp": 0.0 "wifi_temp": 0.0,
"wifi_signal": get_wifi_signal()
} }
# NVIDIA GPU metrics via nvidia-smi # NVIDIA GPU metrics via nvidia-smi
@ -277,6 +292,7 @@ def stream_stats():
"gpu_history": list(gpu_history), "gpu_history": list(gpu_history),
"nvme_temp": hw["nvme_temp"], "nvme_temp": hw["nvme_temp"],
"wifi_temp": hw["wifi_temp"], "wifi_temp": hw["wifi_temp"],
"wifi_signal": hw["wifi_signal"],
"ram_used": ram_used, "ram_used": ram_used,
"ram_total": ram_total, "ram_total": ram_total,
"ram_pct": ram_pct, "ram_pct": ram_pct,