This is another post on the Hyprland series.
In a previous post, I showed how to create a custom button in the Waybar for wlogout: a wlogout is a logout menu for Wayland environments:
Remember that in Arch, this is available as an AUR package, e.g., you have to install it through an AUR helper like Yay:
1 |
yay -S wlogout |
Of course, you can also test it by running that from the command line.
However, I hadn’t realized that when I click logout in wlogout, I always get a black screen: I don’t return to the SDDM menu.
However, that’s easy to fix, and you can also take the chance to customize its aspect.
First, you have to create its configuration layout file, e.g., by starting from the default one:
1 2 3 |
mkdir -p ~/.config/wlogout cp /etc/wlogout/layout ~/.config/wlogout/ |
Then, we can edit the layout file we copied into “~/.config/wlogout/layout” and change this section
1 2 3 4 5 6 |
{ "label" : "logout", "action" : "loginctl terminate-user $USER", "text" : "Logout", "keybind" : "e" } |
into
1 2 3 4 5 6 |
{ "label" : "logout", "action" : "sleep 1; hyprctl dispatch exit", "text" : "Logout", "keybind" : "e" } |
Now, logout will work fine.
Let’s also configure “Swaylock” for screen locking, as I have already shown in this previous blog post.
If you still haven’t installed that:
1 |
sudo pacman -S swaylock |
The default screen locking uses a bright screen. Let’s make it darker:
1 |
mkdir ~/.config/swaylock |
And let’s create and edit its configuration file “~/.config/swaylock/config”; in this example, I’m going to make it “dark green”, so I’m specifying:
1 |
color=032205FF |
By looking at its “man page”, we can see:
-c, –color <rrggbb[aa]>
Turn the screen into the given color instead of white. If -i is used, this sets the background of the image to the given color. Defaults to white (FFFFFF).
The “aa” in the previously present hex notation is the alpha value defining the color’s opacity. In the above example, I’m using no opacity.
This is my complete configuration file for swaylock:
1 2 3 |
daemonize show-failed-attempts color=032205FF |
Again, the “man page” explains these values:
-F, –show-failed-attempts
Show the current count of failed authentication attempts.-f, –daemonize
Detach from the controlling terminal after locking.
In my Hyprland configuration file, I also use “swayidle” (the Idle management daemon for Wayland)
1 2 3 4 |
# Screensaver and lock screen # Swaylock configuration in ~/.config/swaylock/config $lock = swaylock exec-once = swayidle -w timeout 300 '$lock' timeout 300 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep '$lock' |
In my waybar configuration, I have:
1 2 3 4 5 6 7 |
"modules-right": ["idle_inhibitor", "pulseaudio", "backlight", "battery", "clock", "keyboard-state", "tray", "custom/power"], ... "custom/power": { "format": " ⏻ ", "tooltip": false, "on-click": "wlogout --protocol layer-shell" } |
Note that I’ve used a character using the installed Nerd font. Of course, you can choose anything you like. The “wlogout” menu will appear when you click on that module.
That’s all for this post 🙂
Thank you for these hyprland articles.
When I configure wlogout as you describe, and use it to logout 1) the wlogout menu disappears 2) nothing happens until I press any other key. At that keypress the logout occurs. Is there a way to make the logout happen immediately?
Are you sure you followed the instructions and configurations thoroughly? Including the “sleep” command?
What happens if you call the wlogout manually from the command line?
Otherwise it might be due to a temporary bug?