A small Wayland idle inhibitor written in Rust. Prevents your compositor from locking the screen or suspending while a command is running or until you stop it manually.
- Foreground mode — inhibits idle until
Ctrl-CorSIGTERM - Command mode — wraps a command and releases inhibition when it exits
- Timeout — stop automatically after a given duration (
30s,5m,2h) - Quiet mode — suppress all output for use in scripts
- Exit code propagation — in command mode, exits with the same code as the wrapped command
- PID file — write the PID to a file for signaling from scripts or status bars
- Hooks — run shell commands when inhibition starts and stops
- Dry-run — test hooks and scripts without a live compositor
- Toggle — start/stop from a single keybind or status bar click
Arch Linux (AUR)
yay -S wayinhibit
# or: paru -S wayinhibitCargo
cargo install wayinhibitNix
nix run github:MedCy1/wayinhibitBuild from source
git clone https://github.com/MedCy1/wayinhibit
cd wayinhibit
cargo build --releaseInhibit idle until Ctrl-C:
wayinhibitInhibit idle while a command runs, then exit with its exit code:
wayinhibit -- rsync -av /src /dst
wayinhibit -- yt-dlp https://example.com/video
wayinhibit -- ssh user@host 'long-running-task'Stop automatically after a timeout:
wayinhibit --timeout 2h
wayinhibit --timeout 30m -- ./backup.shUse in a script without any output:
wayinhibit --quiet -- ./encode.shSignal from another terminal using the printed PID:
# terminal 1
wayinhibit
# Inhibiting idle. PID: 12345. Press Ctrl-C to stop.
# terminal 2
kill 12345Write the PID to a file so other scripts can signal it:
wayinhibit --quiet --pid-file /tmp/wayinhibit.pid &
kill "$(cat /tmp/wayinhibit.pid)"Run shell commands when inhibition starts and stops:
wayinhibit \
--on-inhibit "notify-send wayinhibit 'Idle inhibited'" \
--on-release "notify-send wayinhibit 'Idle released'"Test your hooks without a live compositor:
wayinhibit --dry-run --timeout 5s \
--on-inhibit "echo start" \
--on-release "echo stop"Toggle inhibition from a single command (starts it if not running, stops it if running) — handy for a keybind or a status bar click handler:
wayinhibit --quiet --toggle --pid-file /tmp/wayinhibit.pid| Flag | Description |
|---|---|
-t, --timeout <DURATION> |
Stop after a given duration (30s, 5m, 2h) |
-q, --quiet |
Suppress all output |
-p, --pid-file <PATH> |
Write PID to PATH on startup, remove it on exit |
--on-inhibit <CMD> |
Run CMD via sh -c when inhibition starts |
--on-release <CMD> |
Run CMD via sh -c when inhibition stops |
--dry-run |
Run without connecting to Wayland (for testing hooks) |
--toggle |
Stop the running instance from --pid-file, or start one |
-h, --help |
Print help |
-V, --version |
Print version |
Option 1 — Waybar built-in module (no wayinhibit required):
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
}Option 2 — Custom module using wayinhibit (supports hooks, pid-file, timeout):
"custom/idle-inhibitor": {
"exec": "[ -f /tmp/wayinhibit.pid ] && echo ' inhibiting' || echo ' idle'",
"interval": 2,
"on-click": "wayinhibit --quiet --toggle --pid-file /tmp/wayinhibit.pid &",
"tooltip": false
}Use option 2 if you want --on-inhibit/--on-release hooks, a timeout, or need to drive wayinhibit from other scripts as well.
Requires a compositor that supports the zwp_idle_inhibit_manager_v1 Wayland protocol, which includes:
- wlroots-based: Sway, Hyprland, river, labwc, Wayfire, Cage, niri
- GNOME (Mutter, Wayland session)
- KDE Plasma (KWin, Wayland session)
- Cinnamon (Muffin, Wayland session)
- COSMIC, Mir, Louvre, phoc, Jay, Treeland
wayinhibit only inhibits the compositor's idle state (screen lock, screen off). It does not prevent systemd-logind from suspending the system on events it handles itself, such as closing a laptop lid.
Install the repository Git hooks:
make setupRun the full quality suite:
make qualityIndividual checks:
make fmt # Check formatting
make clippy # Run Clippy
make test # Run tests
make e2e # Run end-to-end tests against a real headless Sway (requires `sway`)See CONTRIBUTING.md for more details.
MIT — see LICENSE.