wl-restart(1)
okay so this is wl-restart(1) from the General Commands Manual, and bestie itβs literally the βplease donβt let my compositor crash take everything down with itβ tool πβ¨
πΈ NAME πΈ
wl-restart β restart your compositor when it crashes π«Ά
β¨ SYNOPSIS β¨
wl-restart [[-h,-n N] --] <compositor args>
π DESCRIPTION π
okay so wl-restart is a simple tool that restarts your compositor when it crashes. It also creates and destroys the Wayland socket for the compositor, so that clients that support seamless compositor reconnects (most KDE programs, e.g. konsole) donβt die with it when your compositor crashes. iconic behaviour, honestly π
wl-restart will create a Wayland socket, and then starts the given compositor, passing along the Wayland socket FD to the compositor with the options --socket NAME and --wayland-fd FD. When the compositor crashes, wl-restart will restart the compositor up to 10 times, after which it gives up. Details are listed in BEHAVIOUR below. no cap, itβs all very systematic π
π Example Usage π
$ wl-restart sway
$ wl-restart -n 7 hyprland
This only works for compositors that support Wayland socket handover and that support the --socket and --wayland-fd options or any of the other socket handover mechanisms detailed under OPTIONS. Currently that is only Kwin and Hyprland, but patches exist for sway and labwc. For details, see COMPOSITOR SUPPORT below. lowkey a small club rn π
Currently there arenβt many clients and toolkits that support surviving a compositor restart, with Qt6 and the KDE apps being a notable exception. For details, see CLIENT AND TOOLKIT SUPPORT below. fr fr, the support list is still growing π¦
π OPTIONS π
-h,--helpβ Show help message and exit. easy peasy π-n N,--max-restarts Nβ Restart the compositor a maximum ofNtimes. (default is 10) bestie gets 10 tries π--kdeβ Pass socket via cli options--socketand--wayland-fd. (default) This passes the socket in the same form as KDEβskwin_wayland_wrapper. the classic route π--envβ Pass socket via env varsWAYLAND_SOCKET_NAMEandWAYLAND_SOCKET_FD. the environment-variable route β¨
π₯ BEHAVIOUR π₯
wl-restart first finds a free wayland socket name (e.g. wayland-1) and creates it. main character setup energy π
Then, it starts the compositor with the given arguments, but with --socket wayland-N --wayland-fd FD appended to the arguments. itβs giving βhereβs your socket, go offβ π
If the compositor exits with exit code 0, wl-restart cleans up the socket and exits as well. clean exit, slay π§
If the compositor exits with exit code 133 (signal SIGTRAP), wl-restart resets the restart counter and restarts the compositor. plot twist, counter reset π
If the compositor exits with any other exit code, wl-restart increments the restart counter and restarts the compositor if it is smaller than the maximum. Otherwise, wl-restart cleans up the socket and exits as well. eventually itβs like βokay bestie, Iβve done all I canβ π
When the compositor is restarted, wl-restart sets the environment variable WL_RESTART_COUNT to the restart counter, so other scripts can react to it and e.g. display a message or restart services that donβt restart automatically. very βtell the group chat what happenedβ π«Ά
When wl-restart receives a SIGINT or SIGTERM signal, it kills the compositor with SIGTERM if itβs currently running, cleans up the socket, and exits. dramatic but responsible π
When wl-restart receives a SIGHUP signal, it kills the compositor with SIGTERM if itβs currently running, waits for it to die, and restarts it without incrementing the restart counter. special little reload moment β¨
π COMPOSITOR SUPPORT π
wl-restart only works for compositors that support Wayland socket handover via the --socket and --wayland-fd options. vibe check passed only for the chosen ones π
π kwin_wayland
Kwin supports socket handover, but wl-restart isnβt necessary or recommended for it, since automatic restarting for it is already implemented by kwin_wayland_wrapper, which is automatically used in startplasma_wayland. so Kwin already has its own built-in bestie π«Ά
Kwin uses the KDE socket handover mechanism.
π hyprland
Hyprland supports socket handover and works well with wl-restart. obsessed, honestly π₯
Hyprland uses the KDE socket handover mechanism.
π¦ sway
Upstream Sway does not support socket handover, but socket handover is implemented in the following branch and works well with wl-restart:
https://github.com/ferdi265/sway/tree/feature-socket-handover
This branch uses the KDE socket handover mechanism.
https://github.com/ferdi265/sway/tree/feature-socket-handover-alternative
This alternative branch uses the env var socket handover mechanism.
πΈ labwc
Upstream labwc does not support socket handover, but socket handover is implemented in the following branch and works with wl-restart:
https://github.com/ferdi265/labwc/tree/feature-socket-handover
This branch uses the env var socket handover mechanism.
Other compositors do not support Wayland socket handover as of now. If there are any compositors with support for socket handover missing from this list, please open an issue for it on GitHub. bestie if you know one, speak up π
π§ CLIENT AND TOOLKIT SUPPORT π§
The socket handover implemented by wl-restart and compatible compositors allows Wayland clients to survive a crash or restart of the compositor without losing any state. However, this needs explicit support in the client or toolkit used. no cap, the client has to be in on the plan β¨
π Qt
Qt supports surviving a compositor restart in Qt6. The environment variable QT_WAYLAND_RECONNECT=1 needs to be set in order for Qt apps to stay alive when the compositor crashes. set the var, keep the app alive π
πΈ GTK
GTK does not currently support surviving a compositor restart. There is a branch with a working implementation, but it hasnβt been merged yet. weβre waiting on the merge, bestie π
π¦ SDL
SDL does not currently support surviving a compositor restart. There is a branch with a working implementation, but it hasnβt been merged yet. same story, still pending π«Ά
A more complete list of toolkits and their state supporting this can be found at the following link:
https://invent.kde.org/plasma/kwin/-/wikis/Restarting
π AUTHORS π
Maintained by Ferdinand Bachmann <ferdinand.bachmann@yrlf.at>. More information on wl-restart can be found at <https://github.com/Ferdi265/wl-restart>. periodt π
byeee from wl-restart(1) in the General Commands Manual, dated 1980-01-01 π«Άβ¨
π¦ where this page comes from
- nixos 26.05: wl-restart 0.3.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms