Feature-parity with Python v0.2.0. Same CSS, same UI, same actions. Single 3.1 MB binary with embedded resources (CSS, wallpaper, avatar). Modules: power.rs, i18n.rs, config.rs, users.rs, panel.rs, main.rs 45 unit tests passing. Python sources retained as reference.
58 lines
2.2 KiB
Markdown
58 lines
2.2 KiB
Markdown
# Moonset
|
|
|
|
**Name**: Hekate (Göttin der Wegkreuzungen — passend zum Power-Menu, das den Weg der Session bestimmt)
|
|
|
|
## Projekt
|
|
|
|
Moonset ist ein Wayland Session Power Menu, gebaut mit Rust + gtk4-rs + gtk4-layer-shell.
|
|
Teil des Moonarch-Ökosystems. Per Keybind aufrufbares Overlay mit 5 Aktionen:
|
|
Lock, Logout, Hibernate, Reboot, Shutdown.
|
|
|
|
## Tech-Stack
|
|
|
|
- Rust (Edition 2024), gtk4-rs 0.11, glib 0.22
|
|
- gtk4-layer-shell 0.8 für Wayland Layer Shell (OVERLAY Layer)
|
|
- `cargo test` für Unit-Tests
|
|
- Python-Quellen in `src/moonset/` als Referenz erhalten
|
|
|
|
## Projektstruktur
|
|
|
|
- `src/` — Rust-Quellcode (main.rs, power.rs, i18n.rs, config.rs, users.rs, panel.rs)
|
|
- `resources/` — GResource-Assets (style.css, wallpaper.jpg, default-avatar.svg)
|
|
- `config/` — Beispiel-Konfigurationsdateien
|
|
- `src/moonset/` — Python-Referenzimplementierung (v0.2.0)
|
|
- `tests/` — Python-Tests (Referenz)
|
|
|
|
## Kommandos
|
|
|
|
```bash
|
|
# Tests ausführen
|
|
cargo test
|
|
|
|
# Release-Build
|
|
cargo build --release
|
|
|
|
# Power-Menu starten (in Niri-Session)
|
|
LD_PRELOAD=/usr/lib/libgtk4-layer-shell.so ./target/release/moonset
|
|
```
|
|
|
|
## Architektur
|
|
|
|
- `power.rs` — 5 Power-Action-Wrapper (lock, logout, hibernate, reboot, shutdown)
|
|
- `i18n.rs` — Locale-Erkennung und String-Tabellen (DE/EN)
|
|
- `config.rs` — TOML-Config + Wallpaper-Fallback
|
|
- `panel.rs` — GTK4 UI (Action-Buttons, Inline-Confirmation, WallpaperWindow)
|
|
- `main.rs` — Entry Point, GTK App, Layer Shell Setup, Multi-Monitor
|
|
- `resources/style.css` — Catppuccin Mocha Theme (aus Python-Version übernommen)
|
|
|
|
## Design Decisions
|
|
|
|
- **OVERLAY statt TOP Layer**: Waybar liegt auf TOP, moonset muss darüber
|
|
- **Niri-spezifischer Logout** (`niri msg action quit`): Moonarch setzt fest auf Niri
|
|
- **Einmal-Start per Keybind**: Kein Daemon, GTK `application_id` verhindert Doppelstart
|
|
- **System-Icons**: Adwaita/Catppuccin liefern alle benötigten symbolischen Icons
|
|
- **Lock ohne Confirmation**: Lock ist sofort reversibel, braucht kein Confirm
|
|
- **Icon-Scaling**: 22px Theme-Variante laden, auf 64px skalieren via GdkPixbuf
|
|
- **GResource-Bundle**: CSS, Wallpaper und Default-Avatar sind in die Binary kompiliert
|
|
- **Async Power Actions**: `glib::spawn_future_local` + `gio::spawn_blocking` statt raw Threads
|