#wayland #gtk4-layer-shell #layer-shell

app wlr-screen-fade

Fade the screen to black using wlr layer shell

2 releases

Uses new Rust 2024

new 0.1.1 Apr 14, 2025
0.1.0 Apr 14, 2025

#628 in Command line utilities

Download history 159/week @ 2025-04-09

159 downloads per month

MIT license

10KB
90 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

Run wlr-screen-fade and the screen while fade to black within 10,000 ms.

You can pass a different time (in milliseconds) with the -t flag.

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

If the program manages to run without interruption it will exit with code 0. This allows you to chain additional programs to execute once the screen turned completely black.

For example I use it with swayidle and wlopm so the screen doesn't turn off abruptly when the system is idle and instead allows the user to abort the execution of wlopm (by doing any input) while the fade animation is still playing:

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

Installation

Make sure the following dependencies are installed on your system

  • gtk4
  • gtk4-layer-shell
  • pkg-config

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

cargo install wlr-screen-fade

Alternatively clone the repository to install the current development version:

git clone https://codeberg.org/qtea/wlr-screen-fade
cd wlr-screen-fade
cargo install --path .

Dependencies

~17–25MB
~476K SLoC