A Wayland layer-shell logout prompt!
Originally a fork of wlogout, wleave is now natively GTK4 & Libadwaita and
has a bunch of added quality-of-life features.
wleave can be installed from the AUR:
paru -S wleave-gitDependencies:
- gtk4-layer-shell
- gtk4
- librsvg (for SVG images)
- libadwaita
- a stable version of the Rust toolchain
You can run the application using cargo run --release or GNU make:
make
./target/release/wleaveThe command line options are backwards-compatible with wlogout.
See --help for a list of options.
The <Esc> key closes the menu, an option to change this may be added eventually.
wleave is backwards-compatible with wlogout configuration files.
Since version 0.6.0, full JSON configuration can be used in place of the wlogout-based
configuration. The default configuration file can be copied from /etc/wleave/layout.json.
The new configuration system is more flexible as it removes the need for extra command-line
arguments.
From man 5 wleave.json, the allowed top-level options are:
"buttons"(array) - a list of buttons"css"(string) - Specify a custom CSS file instead of the default one"service": false(boolean) Run the application as a service, with all instances of wleave opening this one. Allows faster startup at the cost of running in the background"button-layout": "grid"Specify the way buttons should be laid out. See dynamic layouts for more details."buttons-per-row": "3"(string) Set the number of buttons per row, or use a fraction to specify the number of rows to be used (e.g. "1/1" for all buttons in a single row, "1/5" to distribute the buttons over 5 rows)"column-spacing": "8px"(number / "#px" / "#%") Set space between buttons columns"row-spacing": "8px"(number / "#px" / "#%") Set space between buttons rows"margin": "20%"(number / "#px" / "#%") Set margin on all sides"margin-left"(number / "#px" / "#%") Set margin for left of buttons. Falls back to the value set by margin"margin-right"(number / "#px" / "#%") Set margin for right of buttons. Falls back to the value set by margin"margin-top"(number / "#px" / "#%") Set margin for top of buttons. Falls back to the value set by margin"margin-bottom"(number / "#px" / "#%") Set margin for bottom of buttons. Falls back to the value set by margin"button-aspect-ratio"(string or number) Set the aspect ratio of the buttons, either as a float (as a number or string) or a ratio (e.g. "5/4"). If unspecified, the buttons fill all available space between the margins."close-on-lost-focus": false(boolean) Closes the menu if focus is lost"show-keybinds": false: (boolean) Show the associated key binds for each button"protocol": "layer-shell"("layer-shell"/"xdg"/"none") Backend to use for full-screening the menu"no-version-info": false(boolean) Hides the version label."delay-command-ms": 100(number) The number of milliseconds to wait after an action before the associated command is executed
The command-line option counterparts of these options take precedence over the configuration file.
Example configuration with one button that executes swaylock on click:
{
"margin": 200,
"buttons-per-row": "1/1",
"delay-command-ms": 100,
"close-on-lost-focus": true,
"show-keybinds": true,
"buttons": [
{
"label": "lock",
"action": "swaylock",
"text": "Lock",
"keybind": "l",
"icon": "/usr/share/wleave/icons/lock.svg"
}
]
}Layout files may also be read from stdin with --layout -.
For example, with jq, buttons can be picked out:
$ jq '.buttons[] |= select([.label] | inside(["lock", "logout"]))' layout.json | wleave --layout -Add the flag --service to run the application as a service, waiting until it is activated by another
call to wleave. This allows faster startup at the cost of running in the background.
For example, to run wleave in the background with the Niri compositor,
spawn the application on startup:
spawn-at-startup "wleave" "--service"Currently, the configuration is determined by the background instance, and a restart is necessary to apply configuration changes.
Choose one of the available layouts, using the --button-layout option.
Name: "grid"
Since: 0.7
The default mode, with buttons being simply laid out in a grid.
The action field can be an object with exactly one of shell or executable properties set. The shell action
executes the given command in the system shell, while the executable action executes the specified binary,
assuming it is in $PATH. executable actions get filtered if the specified executable does not exist,
allowing multiple possible options.
Any action that is a plain string is interpreted as a shell command with no conditions set.
Any extra properties in the action objects are interpreted as filters. Currently, only environment variable filtering
is implemented, where the values of fields prefixed with $ are matched as conditions for the given action.
The action field can also be an array where the first matching command is picked.
For example, in the following example, the loginctl lock-session command is executed on GNOME, while other desktop
environments will try gtklock and then swaylock.
{
"action": [
{
"$DESKTOP_SESSION": "gnome",
"shell": "loginctl lock-session"
},
{
"executable": "gtklock"
},
"swaylock"
]
}By default, wleave follows libadwaita colors and uses CSS variables.
This allows following the system light/dark theme preference from GNOME settings.
In other desktop environments, this may be changed with
gsettings set org.gnome.desktop.interface color-scheme "'prefer-dark'" or
gsettings set org.gnome.desktop.interface color-scheme "'prefer-light'" correspondingly.
The stylesheet in /etc/wleave/style.css is fully customizable and can be edited.
SVG icons are dynamically recolored if possible. (since 0.6.2)
Each button has an identifier set in the layout file, which allows custom-styling each button
one-by-one. Icon colors may be changed by modifying the CSS variable --view-fg-color,
or by setting a custom color property entirely.
Example stylesheet that makes the selected icon colored with the libadwaita accent color:
window {
background-color: rgba(12, 12, 12, 0.8);
}
button {
color: var(--view-fg-color);
background-color: var(--view-bg-color);
border: none;
padding: 10px;
}
button label.action-name {
font-size: 24px;
}
button label.keybind {
font-size: 20px;
font-family: monospace;
}
button:hover label.keybind, button:focus label.keybind {
opacity: 1;
}
button:hover,
button:focus {
color: var(--accent-color);
background-color: var(--window-bg-color);
}
button:active {
color: var(--accent-fg-color);
background-color: var(--accent-bg-color);
}See https://gitlab.gnome.org/GNOME/gtk/-/blob/4.18.0/gdk/keynames.txt for a list of valid keybinds.
- A desktop file since 0.7
- Conditionally pick different actions on different desktop environments since 0.7
- SVG icons can be colorized via CSS
colorsince 0.6 - Libadwaita accent colors since 0.6
- Automatic light theme by default since 0.6
- Natively GTK4 since 0.5
- New pretty icons by @earth-walker
- Autoclose when window focus is lost (the
-f/--close-on-lost-focusflag) - Mnemonic labels (the
-k/--show-keybindsflag) - Pretty gaps by default
- Less error-prone
- Keybinds accept modifier keys and Unicode characters
- Easier to extend
