CI: migrate release workflow from GitHub Actions to Forgejo Actions
All checks were successful
Mirror to GitHub / mirror (push) Successful in 27s
All checks were successful
Mirror to GitHub / mirror (push) Successful in 27s
GitHub Actions self-hosted runners need per-repo registration on a personal account; Forgejo Actions' runner already serves every repo with zero setup. Moves release publishing there (dl.breadway.dev stays the primary bakery target; GitHub release upload is kept as the fallback via an explicit token, since Forgejo Actions has no ambient GITHUB_TOKEN) and adds a mirror workflow to keep GitHub in sync automatically.
This commit is contained in:
parent
31b2d10909
commit
db5db79471
8 changed files with 220 additions and 91 deletions
|
|
@ -14,8 +14,6 @@ jobs:
|
|||
set -euo pipefail
|
||||
git clone --mirror "https://git.breadway.dev/${GITHUB_REPOSITORY}.git" repo.git
|
||||
cd repo.git
|
||||
# Mirror only branches and tags (not refs/pull/*, which GitHub rejects);
|
||||
# --prune deletes GitHub refs that no longer exist on Forgejo.
|
||||
git push --prune \
|
||||
"https://x-access-token:${{ secrets.MIRROR_TOKEN }}@github.com/Breadway/breadbar.git" \
|
||||
'+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*'
|
||||
|
|
|
|||
53
.forgejo/workflows/release.yml
Normal file
53
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted, hestia]
|
||||
steps:
|
||||
- name: checkout
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf src && mkdir src
|
||||
git clone --branch "${GITHUB_REF_NAME}" --depth 1 \
|
||||
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" src
|
||||
|
||||
- name: build
|
||||
run: cd src && cargo build --release --locked
|
||||
|
||||
- name: prepare artifacts
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
PKG_DIR="/srv/breadway-dl/breadbar/${VERSION}"
|
||||
mkdir -p "${PKG_DIR}"
|
||||
cp src/target/release/breadbar "${PKG_DIR}/breadbar-x86_64"
|
||||
strip "${PKG_DIR}/breadbar-x86_64"
|
||||
sha256sum "${PKG_DIR}/breadbar-x86_64" | awk '{print $1}' \
|
||||
> "${PKG_DIR}/breadbar-x86_64.sha256"
|
||||
cp src/bakery.toml "${PKG_DIR}/bakery.toml"
|
||||
ln -sfn "${VERSION}" "/srv/breadway-dl/breadbar/latest"
|
||||
|
||||
- name: regenerate index.json
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf /tmp/bread-ecosystem-ci
|
||||
git clone https://git.breadway.dev/Breadway/bread-ecosystem.git /tmp/bread-ecosystem-ci
|
||||
bash /tmp/bread-ecosystem-ci/scripts/gen-index.sh
|
||||
|
||||
- name: upload to GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
PKG_DIR="/srv/breadway-dl/breadbar/${VERSION}"
|
||||
gh release create "${GITHUB_REF_NAME}" --repo Breadway/breadbar \
|
||||
--title "breadbar v${VERSION}" --generate-notes 2>/dev/null || true
|
||||
gh release upload "${GITHUB_REF_NAME}" --repo Breadway/breadbar \
|
||||
"${PKG_DIR}/breadbar-x86_64" \
|
||||
"${PKG_DIR}/breadbar-x86_64.sha256" \
|
||||
--clobber
|
||||
57
.github/workflows/release.yml
vendored
57
.github/workflows/release.yml
vendored
|
|
@ -1,57 +0,0 @@
|
|||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
DL_DIR: /srv/breadway-dl
|
||||
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted, hestia]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: install build deps
|
||||
run: sudo apt-get install -y libgtk-4-dev libdbus-1-dev pkg-config iw 2>/dev/null || true
|
||||
|
||||
- name: build
|
||||
run: cargo build --release --locked
|
||||
|
||||
- name: prepare artifacts
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
PKG_DIR="${DL_DIR}/breadbar/${VERSION}"
|
||||
mkdir -p "${PKG_DIR}"
|
||||
cp target/release/breadbar "${PKG_DIR}/breadbar-x86_64"
|
||||
strip "${PKG_DIR}/breadbar-x86_64"
|
||||
sha256sum "${PKG_DIR}/breadbar-x86_64" | awk '{print $1}' \
|
||||
> "${PKG_DIR}/breadbar-x86_64.sha256"
|
||||
cp bakery.toml "${PKG_DIR}/bakery.toml"
|
||||
ln -sfn "${VERSION}" "${DL_DIR}/breadbar/latest"
|
||||
|
||||
- name: ensure bread-ecosystem
|
||||
run: |
|
||||
rm -rf "${ECOSYSTEM_DIR}"
|
||||
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
|
||||
|
||||
- name: regenerate index.json
|
||||
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"
|
||||
|
||||
- name: upload to GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
PKG_DIR="${DL_DIR}/breadbar/${VERSION}"
|
||||
gh release create "${GITHUB_REF_NAME}" \
|
||||
--title "breadbar v${VERSION}" --generate-notes 2>/dev/null || true
|
||||
gh release upload "${GITHUB_REF_NAME}" \
|
||||
"${PKG_DIR}/breadbar-x86_64" \
|
||||
"${PKG_DIR}/breadbar-x86_64.sha256" \
|
||||
--clobber
|
||||
59
README.md
59
README.md
|
|
@ -2,40 +2,69 @@
|
|||
|
||||
Minimal status bar and notification daemon for [Hyprland](https://hyprland.org/) on Wayland.
|
||||
|
||||
A single Rust binary that provides a full-width top bar, a system tray, and a standards-compliant D-Bus notification daemon. No launcher, no wallpaper logic.
|
||||
A single Rust binary that provides a full-width top bar, a D-Bus notification daemon, a volume/brightness OSD, and an SNI system tray housed in a control panel popover.
|
||||
|
||||
## Features
|
||||
|
||||
**Status bar** (anchored to the top of every monitor via `gtk4-layer-shell`):
|
||||
|
||||
- Left: live workspace buttons sourced from Hyprland IPC, active workspace highlighted
|
||||
- Centre: clock (`HH:MM`, updates at the top of each minute)
|
||||
- Right: CPU%, RAM, power draw (W), battery level + AC indicator, Bluetooth state, WiFi SSID with signal strength, system tray (SNI)
|
||||
- Centre: media widget (track/artist from `playerctl`, click to open prev/play-pause/next controls; hidden when no player is active, lingers up to 30 minutes after the last pause) + clock (`HH:MM`, updates at the top of each minute)
|
||||
- Right: CPU%, RAM, power draw (W), battery level + AC indicator, Bluetooth icon (click to open `blueman-manager`), WiFi SSID with signal-strength icon (click for details popover), hamburger control panel button
|
||||
|
||||
**WiFi popover** (click the WiFi area):
|
||||
|
||||
- Shows current SSID, IP address, and internet/Tailscale connectivity status via `breadcrumbs status`
|
||||
- Lists saved `breadcrumbs` profiles for one-click switching
|
||||
- Shows nearby SSIDs from `breadcrumbs scan-list` (saved networks are clickable to join)
|
||||
- Degrades gracefully if `breadcrumbs` is not installed
|
||||
|
||||
**Control panel** (hamburger button on the right):
|
||||
|
||||
- Volume slider (reads/writes via `wpctl`, up to 150%)
|
||||
- Brightness slider (reads/writes via `brightnessctl`)
|
||||
- Live CPU%, GPU%, and network throughput (download/upload)
|
||||
- Audio output selector (lists PulseAudio sinks via `pactl`, switching takes effect immediately)
|
||||
- System tray (SNI): apps that register with `org.kde.StatusNotifierWatcher` appear as icon buttons
|
||||
- Power buttons: lock (`hyprlock`), suspend, reboot, poweroff
|
||||
|
||||
**Notification daemon**:
|
||||
|
||||
- Implements `org.freedesktop.Notifications` (D-Bus) — works with any standard notification sender (`notify-send`, etc.)
|
||||
- Implements `org.freedesktop.Notifications` (D-Bus) — works with any standard sender (`notify-send`, etc.)
|
||||
- Popups appear top-right, stack vertically, auto-dismiss after the sender-specified timeout (default 5 s)
|
||||
- Supports `CloseNotification`
|
||||
- Supports `CloseNotification` and `replaces_id`
|
||||
|
||||
**Volume/brightness OSD**:
|
||||
|
||||
- Overlay window at the bottom of the screen, auto-dismisses after 2 s
|
||||
- Appears automatically on any `pactl` sink-change event or `sysfs` backlight change
|
||||
|
||||
**Theming**:
|
||||
|
||||
- Reads `~/.cache/wal/colors.json` (pywal) on startup for a palette that matches your wallpaper
|
||||
- Falls back to a Catppuccin Mocha palette if pywal is not present
|
||||
- Uses `bread-theme` for palette loading; reads `~/.cache/wal/colors.json` (pywal) if present, falls back to a Catppuccin Mocha palette
|
||||
- User CSS override: `~/.config/breadbar/style.css`
|
||||
- Send `SIGHUP` to reload the theme at runtime (integrates with wallpaper-change hooks)
|
||||
|
||||
## Dependencies
|
||||
|
||||
Runtime:
|
||||
Runtime (required):
|
||||
|
||||
- GTK4 (≥ 4.12)
|
||||
- `gtk4-layer-shell`
|
||||
- `iw` — for WiFi SSID/signal (`iw dev <iface> link`)
|
||||
- `wpctl` (WirePlumber) — volume read/write
|
||||
- `pactl` (PipeWire-Pulse) — audio sink listing and OSD volume events
|
||||
- `brightnessctl` — brightness read/write
|
||||
- A running Hyprland compositor
|
||||
- D-Bus session bus
|
||||
|
||||
Bluetooth status is read from `/sys/class/rfkill` and BlueZ D-Bus; it degrades gracefully if unavailable.
|
||||
Runtime (optional, degrade gracefully if absent):
|
||||
|
||||
- `playerctl` — media widget; hidden if no player is found
|
||||
- `breadcrumbs` — WiFi popover enrichment (profiles, internet/Tailscale status); basic SSID/signal still shown without it
|
||||
- `blueman-manager` — opened when the Bluetooth icon is clicked; Bluetooth state still shown without it
|
||||
|
||||
Bluetooth state is read from `/sys/class/rfkill` and BlueZ D-Bus and degrades gracefully if unavailable.
|
||||
|
||||
## Building
|
||||
|
||||
|
|
@ -50,7 +79,7 @@ Requirements: Rust 1.77+ (uses `LazyLock`), a GTK4 development environment (`lib
|
|||
On Arch Linux:
|
||||
|
||||
```sh
|
||||
sudo pacman -S gtk4 gtk4-layer-shell iw
|
||||
sudo pacman -S gtk4 gtk4-layer-shell wireplumber pipewire-pulse brightnessctl iw
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
|
|
@ -72,7 +101,7 @@ breadbar claims `org.freedesktop.Notifications` on the session D-Bus on startup.
|
|||
|
||||
### pywal integration
|
||||
|
||||
breadbar reads `~/.cache/wal/colors.json` automatically. To reload after a wallpaper change:
|
||||
breadbar reads `~/.cache/wal/colors.json` automatically (via `bread-theme`). To reload after a wallpaper change:
|
||||
|
||||
```sh
|
||||
pkill -HUP breadbar
|
||||
|
|
@ -87,7 +116,7 @@ pkill -HUP breadbar
|
|||
|
||||
### Custom CSS
|
||||
|
||||
Drop a `~/.config/breadbar/style.css` file and send `SIGHUP` to reload. This CSS is applied at a higher priority than the pywal palette so you can override anything.
|
||||
Drop a `~/.config/breadbar/style.css` file and send `SIGHUP` to reload. This CSS is applied at a higher priority than the generated palette so you can override anything.
|
||||
|
||||
Example — change the font size:
|
||||
|
||||
|
|
@ -105,10 +134,14 @@ Example — change the font size:
|
|||
| `src/bar/workspaces.rs` | Hyprland IPC event stream, workspace buttons |
|
||||
| `src/bar/clock.rs` | Minute-tick clock |
|
||||
| `src/bar/stats.rs` | Polling loop: CPU, RAM, power, battery, Bluetooth, WiFi |
|
||||
| `src/bar/media.rs` | `playerctl` polling, media widget and controls popover |
|
||||
| `src/bar/wifi.rs` | WiFi details popover, `breadcrumbs` profile/scan integration |
|
||||
| `src/bar/control.rs` | Control panel data: volume (`wpctl`), brightness (`brightnessctl`), sinks (`pactl`) |
|
||||
| `src/bar/tray.rs` | `org.kde.StatusNotifierWatcher` D-Bus service, SNI item rendering |
|
||||
| `src/notifications/mod.rs` | `org.freedesktop.Notifications` zbus service |
|
||||
| `src/notifications/popup.rs` | Layer-shell popup window and card stack |
|
||||
| `src/theme.rs` | pywal reader, GTK CSS provider injection |
|
||||
| `src/osd.rs` | Volume/brightness on-screen display |
|
||||
| `src/theme.rs` | `bread-theme` palette loading, GTK CSS provider injection |
|
||||
|
||||
Stats are polled every 2 seconds. Bluetooth and WiFi are sampled every 16 seconds and cached in between to avoid hammering D-Bus and `iw`.
|
||||
|
||||
|
|
|
|||
48
assets/icons-needed.txt
Normal file
48
assets/icons-needed.txt
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
SVG icons needed for breadbar
|
||||
==============================
|
||||
24×24 viewBox. Use `currentColor` for all fill/stroke so icons recolour
|
||||
automatically with the bar theme. Drop finished files in this directory.
|
||||
|
||||
|
||||
Control panel — slider row icons
|
||||
---------------------------------
|
||||
Volume.svg
|
||||
Speaker / soundwave icon for the volume slider row.
|
||||
Currently placeholder: 🔊 emoji label.
|
||||
Usage: control panel, left of volume slider.
|
||||
|
||||
Brightness.svg
|
||||
Sun / light bulb icon for the brightness slider row.
|
||||
Currently placeholder: ☀ emoji label.
|
||||
Usage: control panel, left of brightness slider.
|
||||
|
||||
|
||||
Power section buttons
|
||||
-----------------------
|
||||
Lock.svg
|
||||
Padlock icon — triggers hyprlock (lock screen).
|
||||
Currently placeholder: 🔒
|
||||
|
||||
Sleep.svg
|
||||
Crescent moon or Zzz icon — triggers systemctl suspend.
|
||||
Currently placeholder: 💤
|
||||
|
||||
Restart.svg
|
||||
Circular arrow icon — triggers systemctl reboot.
|
||||
Currently placeholder: 🔄
|
||||
|
||||
Shutdown.svg
|
||||
Power symbol (⏻) icon — triggers systemctl poweroff.
|
||||
Currently placeholder: ⏻
|
||||
|
||||
|
||||
How to wire up icons once SVGs are ready
|
||||
-----------------------------------------
|
||||
Each power button and slider row icon is currently a gtk4::Label with an emoji.
|
||||
To replace with an SVG:
|
||||
|
||||
1. Add the SVG to this directory.
|
||||
2. In main.rs, replace the emoji Label with:
|
||||
gtk4::Image::from_paintable(Some(&svg_texture(asset!("Icon Name.svg"))))
|
||||
3. For slider rows, replace the icon_lbl in build_slider_row() calls,
|
||||
or add an overload that takes an image widget instead of a string.
|
||||
|
|
@ -51,6 +51,7 @@ pub struct Stats {
|
|||
pub wifi_profile: Option<String>,
|
||||
pub cpu_temp: Option<f32>,
|
||||
pub gpu_usage: Option<u8>,
|
||||
pub gpu_temp: Option<f32>,
|
||||
pub net_rx_kbs: f32,
|
||||
pub net_tx_kbs: f32,
|
||||
}
|
||||
|
|
@ -295,23 +296,32 @@ async fn read_wifi() -> (String, &'static str) {
|
|||
(ssid, icon)
|
||||
}
|
||||
|
||||
fn read_cpu_temp() -> Option<f32> {
|
||||
fn read_hwmon_temp(driver_name: &str) -> Option<f32> {
|
||||
for entry in fs::read_dir("/sys/class/hwmon").ok()?.flatten() {
|
||||
let path = entry.path();
|
||||
let Ok(name) = fs::read_to_string(path.join("name")) else { continue };
|
||||
if name.trim() == "k10temp" {
|
||||
let raw = fs::read_to_string(path.join("temp1_input")).ok()?;
|
||||
return Some(raw.trim().parse::<f32>().ok()? / 1000.0);
|
||||
if name.trim() == driver_name {
|
||||
let Ok(raw) = fs::read_to_string(path.join("temp1_input")) else { continue };
|
||||
return raw.trim().parse::<f32>().ok().map(|v| v / 1000.0);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn read_cpu_temp() -> Option<f32> {
|
||||
read_hwmon_temp("k10temp")
|
||||
}
|
||||
|
||||
fn read_gpu_temp() -> Option<f32> {
|
||||
read_hwmon_temp("amdgpu")
|
||||
}
|
||||
|
||||
fn read_gpu_usage() -> Option<u8> {
|
||||
for entry in fs::read_dir("/sys/class/drm").ok()?.flatten() {
|
||||
let path = entry.path().join("device/gpu_busy_percent");
|
||||
if path.exists() {
|
||||
return fs::read_to_string(&path).ok()?.trim().parse().ok();
|
||||
let Ok(raw) = fs::read_to_string(&path) else { continue };
|
||||
return raw.trim().parse().ok();
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
@ -412,6 +422,7 @@ pub async fn poll() -> Stats {
|
|||
let wifi_profile = read_crumbs_profile();
|
||||
let cpu_temp = read_cpu_temp();
|
||||
let gpu_usage = read_gpu_usage();
|
||||
let gpu_temp = read_gpu_temp();
|
||||
let (net_rx_kbs, net_tx_kbs) = read_net_throughput();
|
||||
Stats {
|
||||
cpu: format!("{cpu:.0}%"),
|
||||
|
|
@ -430,6 +441,7 @@ pub async fn poll() -> Stats {
|
|||
wifi_profile,
|
||||
cpu_temp,
|
||||
gpu_usage,
|
||||
gpu_temp,
|
||||
net_rx_kbs,
|
||||
net_tx_kbs,
|
||||
}
|
||||
|
|
|
|||
68
src/main.rs
68
src/main.rs
|
|
@ -65,7 +65,7 @@ pub struct App {
|
|||
panel_sink_dropdown: gtk4::DropDown,
|
||||
panel_sink_signal: Option<gtk4::glib::SignalHandlerId>,
|
||||
panel_sinks: Vec<bar::control::AudioSink>,
|
||||
panel_temp_lbl: gtk4::Label,
|
||||
panel_cpu_lbl: gtk4::Label,
|
||||
panel_gpu_lbl: gtk4::Label,
|
||||
panel_net_lbl: gtk4::Label,
|
||||
|
||||
|
|
@ -326,9 +326,9 @@ impl SimpleComponent for App {
|
|||
let stats_section = gtk4::Box::new(gtk4::Orientation::Vertical, 6);
|
||||
stats_section.add_css_class("control-panel-stats");
|
||||
|
||||
let panel_temp_lbl = gtk4::Label::new(Some("CPU —"));
|
||||
panel_temp_lbl.add_css_class("control-panel-stat");
|
||||
panel_temp_lbl.set_xalign(0.0);
|
||||
let panel_cpu_lbl = gtk4::Label::new(Some("CPU —"));
|
||||
panel_cpu_lbl.add_css_class("control-panel-stat");
|
||||
panel_cpu_lbl.set_xalign(0.0);
|
||||
|
||||
let panel_gpu_lbl = gtk4::Label::new(Some("GPU —"));
|
||||
panel_gpu_lbl.add_css_class("control-panel-stat");
|
||||
|
|
@ -338,7 +338,7 @@ impl SimpleComponent for App {
|
|||
panel_net_lbl.add_css_class("control-panel-stat");
|
||||
panel_net_lbl.set_xalign(0.0);
|
||||
|
||||
stats_section.append(&panel_temp_lbl);
|
||||
stats_section.append(&panel_cpu_lbl);
|
||||
stats_section.append(&panel_gpu_lbl);
|
||||
stats_section.append(&panel_net_lbl);
|
||||
panel_inner.append(&stats_section);
|
||||
|
|
@ -378,6 +378,40 @@ impl SimpleComponent for App {
|
|||
tray_section.append(&tray_box);
|
||||
panel_inner.append(&tray_section);
|
||||
|
||||
panel_inner.append(>k4::Separator::new(gtk4::Orientation::Horizontal));
|
||||
|
||||
// Power section
|
||||
let power_section = gtk4::Box::new(gtk4::Orientation::Vertical, 4);
|
||||
power_section.add_css_class("control-panel-section");
|
||||
let power_header = gtk4::Label::new(Some("Power"));
|
||||
power_header.add_css_class("control-panel-section-header");
|
||||
power_header.set_xalign(0.0);
|
||||
power_section.append(&power_header);
|
||||
|
||||
let power_row = gtk4::Box::new(gtk4::Orientation::Horizontal, 4);
|
||||
power_row.add_css_class("power-row");
|
||||
for (label, cmd) in [
|
||||
("🔒", vec!["hyprlock"]),
|
||||
("💤", vec!["systemctl", "suspend"]),
|
||||
("🔄", vec!["systemctl", "reboot"]),
|
||||
("⏻", vec!["systemctl", "poweroff"]),
|
||||
] {
|
||||
let btn = gtk4::Button::with_label(label);
|
||||
btn.add_css_class("flat");
|
||||
btn.add_css_class("power-btn");
|
||||
btn.connect_clicked(move |_| {
|
||||
let args = cmd.to_vec();
|
||||
relm4::spawn(async move {
|
||||
let _ = tokio::process::Command::new(args[0])
|
||||
.args(&args[1..])
|
||||
.spawn();
|
||||
});
|
||||
});
|
||||
power_row.append(&btn);
|
||||
}
|
||||
power_section.append(&power_row);
|
||||
panel_inner.append(&power_section);
|
||||
|
||||
let control_popover = gtk4::Popover::new();
|
||||
control_popover.add_css_class("control-panel");
|
||||
control_popover.set_child(Some(&panel_inner));
|
||||
|
|
@ -458,7 +492,7 @@ impl SimpleComponent for App {
|
|||
panel_sink_dropdown,
|
||||
panel_sink_signal: None,
|
||||
panel_sinks: vec![],
|
||||
panel_temp_lbl,
|
||||
panel_cpu_lbl,
|
||||
panel_gpu_lbl,
|
||||
panel_net_lbl,
|
||||
tray_box,
|
||||
|
|
@ -533,14 +567,20 @@ impl SimpleComponent for App {
|
|||
|
||||
// Live-update control panel stats while open
|
||||
if self.control_popover.is_visible() {
|
||||
match stats.cpu_temp {
|
||||
Some(t) => self.panel_temp_lbl.set_label(&format!("CPU {t:.0}°C")),
|
||||
None => self.panel_temp_lbl.set_label("CPU —"),
|
||||
}
|
||||
match stats.gpu_usage {
|
||||
Some(g) => self.panel_gpu_lbl.set_label(&format!("GPU {g}%")),
|
||||
None => self.panel_gpu_lbl.set_label("GPU —"),
|
||||
}
|
||||
let cpu_str = match (stats.cpu_temp, stats.cpu.as_str()) {
|
||||
(Some(t), pct) => format!("CPU {pct} {t:.0}°C"),
|
||||
(None, pct) => format!("CPU {pct}"),
|
||||
};
|
||||
self.panel_cpu_lbl.set_label(&cpu_str);
|
||||
|
||||
let gpu_str = match (stats.gpu_usage, stats.gpu_temp) {
|
||||
(Some(u), Some(t)) => format!("GPU {u}% {t:.0}°C"),
|
||||
(Some(u), None) => format!("GPU {u}%"),
|
||||
(None, Some(t)) => format!("GPU {t:.0}°C"),
|
||||
(None, None) => "GPU —".to_string(),
|
||||
};
|
||||
self.panel_gpu_lbl.set_label(&gpu_str);
|
||||
|
||||
self.panel_net_lbl.set_label(&format!(
|
||||
"↓ {} ↑ {}",
|
||||
fmt_speed(stats.net_rx_kbs),
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ fn load_css() -> String {
|
|||
.control-panel-section-header {{ font-size: 10px; font-weight: bold; opacity: 0.5;\
|
||||
letter-spacing: 0.08em; margin-bottom: 4px; }}\
|
||||
.control-panel-sink-dropdown {{ }}\
|
||||
.power-row {{ margin-top: 2px; }}\
|
||||
.power-btn {{ font-size: 16px; min-width: 44px; padding: 4px; border-radius: 6px; }}\
|
||||
separator {{ margin: 4px 0; }}",
|
||||
bg_plain = p.background,
|
||||
bg_rgba = hex_to_rgba(&p.background, 0.92),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue