Files
cooling_pad_fan_controller/waybar/README.md
T
fegger eb095dcb47 Add Waybar widget for fan controller
Includes a Python script, Waybar config snippet, and README with install
instructions, usage, and optional CSS styling.
2026-09-11 10:33:41 +02:00

52 lines
1.5 KiB
Markdown

# Waybar widget for the fan controller
A `custom/fan` Waybar module that talks to `fan_controller` over its Unix
socket (`/tmp/fan_controller.sock`) — the same protocol as `FanController.qml`.
## Install
1. Copy the script:
```sh
mkdir -p ~/.config/waybar/scripts
cp waybar/fan.py ~/.config/waybar/scripts/
chmod +x ~/.config/waybar/scripts/fan.py
```
2. Add the `custom/fan` entry from [`fan.json`](fan.json) to
`~/.config/waybar/config.json` (merge it into your existing module list,
e.g. under `modules-right`).
3. Restart Waybar.
## Usage
- **Status** — shows `temp / mode`, e.g. `48.3° auto 55°` or `51.0° 75%`.
Hover for a tooltip with temp, duty, RPM, mode and safe-mode state.
- **Left click** — cycles `auto → 25% → 50% → 75% → 100% → auto`.
- **Right click** — returns to auto mode.
- CLI equivalents:
```sh
fan.py cycle # same as left click
fan.py auto # same as right click
fan.py duty 75 # set manual duty (0-100)
fan.py setpoint 55 # set auto setpoint (35-85)
```
## Optional styling
The script sets CSS classes `fan`, plus `offline` when the controller is
unreachable and `safe` in safe mode. Example for `style.css`:
```css
#waybar .fan.offline { background: #505050; }
#waybar .fan.safe { background: #e05050; }
```
## Notes
- `FAN_CONTROLLER_SOCK` env var overrides the socket path if needed.
- Each poll is a short-lived process (5 s interval), matching how the
Quickshell widget talks to the daemon — no persistent client required.