Files
cooling_pad_fan_controller/waybar
fegger 4a47277c86 Add remote fan tunnel support and rename Waybar widget
Add systemd service to bridge the Pi Unix socket over SSH, make fan.py
fall back to the TCP tunnel, and rename the module from `custom/fan` to
`custom/cooling_pad`. Update README install steps and connection details.
2026-09-11 10:54:00 +02:00
..

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 files:

    mkdir -p ~/.config/waybar/scripts
    cp waybar/fan.py ~/.config/waybar/scripts/
    chmod +x ~/.config/waybar/scripts/fan.py
    
  2. The daemon runs on the Pi, so bridge its Unix socket over SSH once:

    cp waybar/fan-tunnel.service ~/.config/systemd/user/
    systemctl --user daemon-reload
    systemctl --user enable --now fan-tunnel
    

    This forwards 127.0.0.1:10250root@10.55.0.1:/tmp/fan_controller.sock.

  3. Add the custom/cooling_pad entry (below) to ~/.config/waybar/config.jsonc (merge it into your existing module list, e.g. under modules-right).

  4. Restart Waybar.

waybar config

"custom/cooling_pad": {
    "return-type": "json",
    "exec": "~/.config/waybar/scripts/fan.py",
    "interval": 5,
    "on-click": "python3 ~/.config/waybar/scripts/fan.py cycle",
    "on-right-click": "python3 ~/.config/waybar/scripts/fan.py auto"
}

Connection details

fan.py uses the local /tmp/fan_controller.sock if it exists, otherwise the tunnel at 127.0.0.1:10250. Override with FAN_CONTROLLER_ENDPOINT (unix:/path or host:port). If the widget shows fan: offline, check systemctl --user status fan-tunnel and ssh root@10.55.0.1 'ls -la /tmp/fan_controller.sock'.

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:

    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:

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