4 releases (2 breaking)

Uses new Rust 2024

0.3.0 May 24, 2025
0.2.0 Apr 23, 2025
0.1.1 Apr 14, 2025
0.1.0 Apr 14, 2025

#599 in Command line utilities

MIT license

29KB
641 lines

wlr-screen-fade

Crates.io Version License

A simple program that fades the screen to black.

This requires that your Wayland compositor supports the wlr-layer-shell protocol.

Usage

Usage: wlr-screen-fade [OPTIONS] [-- <COMMAND>...]

Arguments:
  [COMMAND]...  Command to run after the fade animation finished

Options:
  -t, --fade-duration <ms>         Time to fade to black (in milliseconds) [default: 10000]
  -r, --reverse                    Fade the screen from black to transparent instead
  -l, --list                       List the names of all available outputs
  -o, --outputs <output_name,...>  Names of the outputs to fade
  -h, --help                       Print help
  -V, --version                    Print version

If any input is detected the program immediately exits with code 1.
If the program manages to run for the entire duration it exits with 0, allowing you to chain additional commands.

Output Names are compositor dependant.
You can specify either a list of comma-separated output names or '*' to fade on all outputs.
If not specified it will only fade the default output.

If the program manages to run without interruption it will exit with code 0.

Any detected input (keyboard, mouse) while the screen is fading will result in the program immediately exiting with code 1.

Examples

You can use wlr-screen-fade together with swayidle and wlopm to fade out the screen before turning it off after the system has been idle for a while. Any user input while the screen is still fading will result in it not turning off.

swayidle -w timeout 300 "wlr-screen-fade -o '*' -t 10000 -- wlopm --off '*'" resume "wlopm --on '*'"

Installation

Cargo

Make sure the following dependencies are installed on your system:

  • libxkbcommon
  • wayland (libwayland-client)
  • pkg-config

You can install the latest release directly from crates.io:

cargo install wlr-screen-fade

Or the current development version from the repository:

cargo install --git https://codeberg.org/qtea/wlr-screen-fade --branch main

Nix Flake

You can test wlr-screen-fade by running it directly:

nix run git+https://codeberg.org/qtea/qwf-overview

Or adding it as an input and then using the provided package:

wlr-screen-fade.packages.x86_64-linux.default

Dependencies

~21–57MB
~880K SLoC