From b8a3424834589271aad016089a10ed0e04197554 Mon Sep 17 00:00:00 2001 From: Breadway Date: Tue, 19 May 2026 12:30:12 +0800 Subject: [PATCH] Prepare repo for public GitHub release Add README, MIT LICENSE, expanded .gitignore, and updated SVG icon set to make the repository presentable for open-source publication. --- .gitignore | 37 +++++++- LICENSE | 21 +++++ README.md | 116 ++++++++++++++++++++++++++ assets/AC Power.svg | 1 + assets/Battery 1 Bar.svg | 1 + assets/Battery 2 Bars.svg | 1 + assets/Battery 3 Bars.svg | 1 + assets/Bluetooth Connected.svg | 1 + assets/Bluetooth Off.svg | 1 + assets/{Battery.svg => Bluetooth.svg} | 2 +- assets/WiFi Disconnect.svg | 1 + 11 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 assets/AC Power.svg create mode 100644 assets/Battery 1 Bar.svg create mode 100644 assets/Battery 2 Bars.svg create mode 100644 assets/Battery 3 Bars.svg create mode 100644 assets/Bluetooth Connected.svg create mode 100644 assets/Bluetooth Off.svg rename assets/{Battery.svg => Bluetooth.svg} (61%) create mode 100644 assets/WiFi Disconnect.svg diff --git a/.gitignore b/.gitignore index b9410c9..816e2ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,37 @@ -/target +# Build artifacts +/target/ + +# Editor files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS artifacts +.DS_Store +Thumbs.db +desktop.ini + +# Environment / secrets +.env +.env.* +*.env +*.pem +*.key +*.p12 +secrets/ + +# Log files +*.log +logs/ + +# Runtime files +*.sock +*.pid + +# Claude Code session data +.claude/ + +# Internal design documents (not for distribution) aster-brief.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..56e6a3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Riley Horsham + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e577e8 --- /dev/null +++ b/README.md @@ -0,0 +1,116 @@ +# breadbar + +Minimal status bar and notification daemon for [Hyprland](https://hyprland.org/) on Wayland. + +A single Rust binary that provides a full-width top bar and a standards-compliant D-Bus notification daemon, with no system tray, no launcher, and no wallpaper logic. + +## 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 + +**Notification daemon**: + +- Implements `org.freedesktop.Notifications` (D-Bus) — works with any standard notification sender (`notify-send`, etc.) +- Popups appear top-right, stack vertically, auto-dismiss after the sender-specified timeout (default 5 s) +- Supports `CloseNotification` + +**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 +- User CSS override: `~/.config/breadbar/style.css` +- Send `SIGHUP` to reload the theme at runtime (integrates with wallpaper-change hooks) + +## Dependencies + +Runtime: + +- GTK4 (≥ 4.12) +- `gtk4-layer-shell` +- `iw` — for WiFi SSID/signal (`iw dev link`) +- 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. + +## Building + +```sh +cargo build --release +``` + +The binary is at `target/release/breadbar`. + +Requirements: Rust 1.77+ (uses `LazyLock`), a GTK4 development environment (`libgtk-4-dev` / `gtk4` package). + +On Arch Linux: + +```sh +sudo pacman -S gtk4 gtk4-layer-shell iw +cargo build --release +``` + +## Running + +```sh +./target/release/breadbar +``` + +Typically launched from your Hyprland config: + +``` +exec-once = /path/to/breadbar +``` + +breadbar claims `org.freedesktop.Notifications` on the session D-Bus on startup. If another notification daemon is already running, startup will fail — stop the other daemon first. + +## Theming + +### pywal integration + +breadbar reads `~/.cache/wal/colors.json` automatically. To reload after a wallpaper change: + +```sh +pkill -HUP breadbar +``` + +Or hook it into your wallpaper script: + +```sh +wal -i /path/to/wallpaper.jpg +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. + +Example — change the font size: + +```css +* { + font-size: 13px; +} +``` + +## Architecture + +| Module | Responsibility | +|---|---| +| `src/main.rs` | GTK4 app entry point, widget tree, `relm4` component | +| `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/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 | + +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`. + +## License + +MIT diff --git a/assets/AC Power.svg b/assets/AC Power.svg new file mode 100644 index 0000000..2bae44c --- /dev/null +++ b/assets/AC Power.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/Battery 1 Bar.svg b/assets/Battery 1 Bar.svg new file mode 100644 index 0000000..4ca262e --- /dev/null +++ b/assets/Battery 1 Bar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/Battery 2 Bars.svg b/assets/Battery 2 Bars.svg new file mode 100644 index 0000000..0e09af1 --- /dev/null +++ b/assets/Battery 2 Bars.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/Battery 3 Bars.svg b/assets/Battery 3 Bars.svg new file mode 100644 index 0000000..61af371 --- /dev/null +++ b/assets/Battery 3 Bars.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/Bluetooth Connected.svg b/assets/Bluetooth Connected.svg new file mode 100644 index 0000000..d581cf9 --- /dev/null +++ b/assets/Bluetooth Connected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/Bluetooth Off.svg b/assets/Bluetooth Off.svg new file mode 100644 index 0000000..b2a109d --- /dev/null +++ b/assets/Bluetooth Off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/Battery.svg b/assets/Bluetooth.svg similarity index 61% rename from assets/Battery.svg rename to assets/Bluetooth.svg index 11b82f5..becb3fa 100644 --- a/assets/Battery.svg +++ b/assets/Bluetooth.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/WiFi Disconnect.svg b/assets/WiFi Disconnect.svg new file mode 100644 index 0000000..5b42390 --- /dev/null +++ b/assets/WiFi Disconnect.svg @@ -0,0 +1 @@ + \ No newline at end of file