# 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.