mirror of
https://github.com/samjage/weather-and-stats.git
synced 2026-06-06 00:20:42 +00:00
fix: restore single-label layout, bump to 1.1, update docs
- Revert split RowLayout network section (broke icon rendering without Nerd Font); restore original single-label approach while keeping Cory's useNerdFont toggle and ic icon table fully intact - Bump version 1.0 → 1.1 - README: Nerd Font now listed as optional, add panel placement note, add useNerdFont to config table, clarify widget is panel/taskbar only
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Weather && Stats
|
# Weather && Stats
|
||||||
|
|
||||||
A KDE Plasma 6 panel widget that displays live weather and system stats in a single compact bar.
|
A KDE Plasma 6 **panel/taskbar widget** that displays live weather and system stats in a single compact bar. Designed to sit in your top or bottom panel — not a desktop widget.
|
||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
@@ -20,8 +20,8 @@ All stats update on configurable intervals. Each section can be toggled on or of
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- KDE Plasma 6.0+
|
- KDE Plasma 6.0+
|
||||||
- A [Nerd Font](https://www.nerdfonts.com/) set as your panel font (for icons)
|
|
||||||
- `bash`, `free`, `/proc/stat`, `/proc/net/dev` (standard on any Linux system)
|
- `bash`, `free`, `/proc/stat`, `/proc/net/dev` (standard on any Linux system)
|
||||||
|
- A [Nerd Font](https://www.nerdfonts.com/) set as your panel font is **optional** — the widget falls back to plain Unicode symbols if disabled in settings
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@ kpackagetool6 --type Plasma/Applet --install weather-and-stats
|
|||||||
|
|
||||||
Then right-click your panel → **Add Widgets** → search for **Weather && Stats**.
|
Then right-click your panel → **Add Widgets** → search for **Weather && Stats**.
|
||||||
|
|
||||||
|
> **Placement:** Plasma always adds new widgets at a default position. After adding, right-click your panel → **Enter Edit Mode** and drag the widget to your preferred spot (e.g. left of the system tray). Plasma has no API for widgets to declare a position automatically.
|
||||||
|
|
||||||
### To update after changes
|
### To update after changes
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -54,6 +56,7 @@ Right-click the widget → **Configure Weather && Stats**:
|
|||||||
| CPU temp alert threshold | Temp at which the reading turns red | 80°C |
|
| CPU temp alert threshold | Temp at which the reading turns red | 80°C |
|
||||||
| Stats refresh | How often to poll system stats (seconds) | 3 sec |
|
| Stats refresh | How often to poll system stats (seconds) | 3 sec |
|
||||||
| Visible stats | Toggle CPU temp, CPU usage, memory, network | All on |
|
| Visible stats | Toggle CPU temp, CPU usage, memory, network | All on |
|
||||||
|
| Use Nerd Font icons | Use Nerd Font glyphs; disable for plain Unicode fallback | On |
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
|
|||||||
+23
-60
@@ -66,74 +66,37 @@ PlasmoidItem {
|
|||||||
// ── Panel display ─────────────────────────────────────────────────────────
|
// ── Panel display ─────────────────────────────────────────────────────────
|
||||||
preferredRepresentation: fullRepresentation
|
preferredRepresentation: fullRepresentation
|
||||||
|
|
||||||
fullRepresentation: RowLayout {
|
fullRepresentation: PlasmaComponents.Label {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
spacing: 0
|
Layout.preferredWidth: implicitWidth + 16
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
textFormat: Text.RichText
|
||||||
|
|
||||||
// ── Main label (weather + cpu/mem) ────────────────────────────────────
|
text: {
|
||||||
PlasmaComponents.Label {
|
var hot = root.cpuTempRaw > 0 && root.cpuTempRaw >= root.cpuTempThreshold
|
||||||
Layout.fillHeight: true
|
var sp = "\u00a0\u00a0\u00a0\u00a0"
|
||||||
Layout.preferredWidth: implicitWidth + 16
|
var div = "\u00a0\u00a0\u2502\u00a0\u00a0"
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
textFormat: Text.RichText
|
|
||||||
|
|
||||||
text: {
|
var s = root.weatherIcon + "\u00a0\u00a0" + root.temperature + "°" + (root.fahrenheit ? "F" : "C")
|
||||||
var hot = root.cpuTempRaw > 0 && root.cpuTempRaw >= root.cpuTempThreshold
|
if (root.showCondition && root.weatherCondition !== "")
|
||||||
var sp = "\u00a0\u00a0\u00a0\u00a0"
|
s += " " + root.weatherCondition
|
||||||
var div = "\u00a0\u00a0\u2502\u00a0\u00a0"
|
|
||||||
|
|
||||||
var s = root.weatherIcon + "\u00a0\u00a0" + root.temperature + "°" + (root.fahrenheit ? "F" : "C")
|
var cpuMem = []
|
||||||
if (root.showCondition && root.weatherCondition !== "")
|
if (root.showCpuTemp) {
|
||||||
s += " " + root.weatherCondition
|
var tempStr = root.ic.cpuTemp + "\u00a0\u00a0" + root.cpuTempDisplay
|
||||||
|
cpuMem.push(hot ? "<font color='#ff5555'>" + tempStr + "</font>" : tempStr)
|
||||||
var cpuMem = []
|
|
||||||
if (root.showCpuTemp) {
|
|
||||||
var tempStr = root.ic.cpuTemp + "\u00a0\u00a0" + root.cpuTempDisplay
|
|
||||||
cpuMem.push(hot ? "<font color='#ff5555'>" + tempStr + "</font>" : tempStr)
|
|
||||||
}
|
|
||||||
if (root.showCpuUsage)
|
|
||||||
cpuMem.push(root.ic.cpu + "\u00a0\u00a0" + (root.cpuUsage >= 0 ? padPct(root.cpuUsage) : "\u00a0--"))
|
|
||||||
if (root.showMemory)
|
|
||||||
cpuMem.push(root.ic.mem + "\u00a0\u00a0" + (root.memUsage >= 0 ? padPct(root.memUsage) : "\u00a0--"))
|
|
||||||
|
|
||||||
if (cpuMem.length > 0) s += div + cpuMem.join(sp)
|
|
||||||
if (root.showNetwork) s += div
|
|
||||||
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
}
|
if (root.showCpuUsage)
|
||||||
|
cpuMem.push(root.ic.cpu + "\u00a0\u00a0" + (root.cpuUsage >= 0 ? padPct(root.cpuUsage) : "\u00a0--"))
|
||||||
|
if (root.showMemory)
|
||||||
|
cpuMem.push(root.ic.mem + "\u00a0\u00a0" + (root.memUsage >= 0 ? padPct(root.memUsage) : "\u00a0--"))
|
||||||
|
|
||||||
// ── Network ───────────────────────────────────────────────────────────
|
if (cpuMem.length > 0) s += div + cpuMem.join(sp)
|
||||||
// A hidden reference label measures the pixel width of the widest
|
|
||||||
// possible value. Both visible labels are pinned to that exact width
|
|
||||||
// (min = preferred = max) so content changes never affect their size.
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
id: netRef
|
|
||||||
visible: false
|
|
||||||
font.family: "monospace"
|
|
||||||
text: "000 MB/s"
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
if (root.showNetwork)
|
||||||
visible: root.showNetwork
|
s += div + root.ic.down + "\u00a0\u00a0" + formatNetSpeed(root.netDown) + sp + root.ic.up + "\u00a0\u00a0" + formatNetSpeed(root.netUp)
|
||||||
font.family: "monospace"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.minimumWidth: netRef.implicitWidth
|
|
||||||
Layout.preferredWidth: netRef.implicitWidth
|
|
||||||
Layout.maximumWidth: netRef.implicitWidth
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: root.ic.down + " " + formatNetSpeed(root.netDown)
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
return s + " "
|
||||||
visible: root.showNetwork
|
|
||||||
font.family: "monospace"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.minimumWidth: netRef.implicitWidth
|
|
||||||
Layout.preferredWidth: netRef.implicitWidth
|
|
||||||
Layout.maximumWidth: netRef.implicitWidth
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: " " + root.ic.up + " " + formatNetSpeed(root.netUp) + " "
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
"Description": "Live weather and system stats for the KDE panel",
|
"Description": "Live weather and system stats for the KDE panel",
|
||||||
"Icon": "weather-clear",
|
"Icon": "weather-clear",
|
||||||
"Id": "com.github.samjage.weatherstats",
|
"Id": "com.github.samjage.weatherstats",
|
||||||
"Version": "1.0",
|
"Version": "1.1",
|
||||||
"License": "GPL-2.0",
|
"License": "GPL-2.0",
|
||||||
"Category": "System Information",
|
"Category": "System Information",
|
||||||
"Authors": [
|
"Authors": [
|
||||||
|
|||||||
Reference in New Issue
Block a user