A small daemon that monitors user idle status via the Wayland ext_idle_notify_v1
protocol and reports activity to Workrave over DBus.
Workrave's built-in idle detection does not work under Wayland compositors that
implement ext_idle_notify_v1 (e.g. KDE Plasma ≥ 5.27, GNOME ≥ 44, sway, COSMIC).
This daemon bridges the gap: it listens for idle/resumed events from the
compositor and calls ReportActivity on the Workrave DBus interface so that
Workrave's break timer stays accurate.
I made this for COSMIC desktop so that it would work with workrave.
- Connects to the Wayland display and binds
wl_seatandext_idle_notifier_v1. - Registers an idle notification with a configurable timeout (default 3 s).
- When the user goes idle the daemon stops sending activity reports.
- When the user resumes, the daemon sends
ReportActivityto Workrave every 2 s (configurable) until the next idle period.
- Go 1.21+
libwayland-clientdevelopment headers (for cgo)- Dependencies are declared in
go.mod:github.com/godbus/dbus/v5github.com/rajveermalviya/go-wayland/wayland
go mod tidy
go build -o workrave-kick .
Start Workrave first, then run the daemon:
# Go (after building)
./workrave-kick
The daemon retries the Workrave DBus connection up to 10 times (1 s apart) before giving up, so it is safe to start it alongside Workrave in an autostart script.
./workrave-kick [OPTIONS]
-n, --no-idle- Disable idle detection (always report active)-d, --dbus-idle- Use DBus idle detection instead of Wayland (experimental, requires Mutter/GNOME)--go-wayland- Use pure Go Wayland library (may not work on all compositors)-h, --help- Show help message
Default behavior: Uses C libwayland-client via CGO for maximum compatibility with all Wayland compositors including COSMIC.
The Go version now uses two implementations:
-
C libwayland-client (default): Uses CGO to call the native libwayland-client library. This works reliably on all Wayland compositors including COSMIC, KDE Plasma, GNOME, and Sway.
-
Pure Go (--go-wayland flag): Uses github.com/rajveermalviya/go-wayland library. This may not work on some compositors like COSMIC due to protocol compatibility issues.
Timeouts are compile-time constants at the top of each source file:
| Constant | Default | Meaning |
|---|---|---|
idleTime |
3 s | How long without input before declaring idle |
kickTime |
2 s | Interval between ReportActivity calls while active |
# ~/.config/systemd/user/workrave-kick.service
[Unit]
Description=Workrave Wayland idle bridge
After=graphical-session.target
[Service]
ExecStart=/usr/local/bin/workrave-kick
Restart=on-failure
[Install]
WantedBy=graphical-session.targetsystemctl --user enable --now workrave-kick.service
The daemon:
- Makes no network connections (Wayland socket and DBus are local IPC only).
- Does not write to the filesystem.
- Does not require elevated privileges.
- Only calls
org.workrave.CoreInterface.ReportActivityon the session DBus.
The credits are in the directory portedfrom that I found in a github issue somewhere
that @ValdikSS had made. rcaelers/workrave#523 (comment)