This is the second blog post on getting started with Hyprland (see the first post here).
In this article, we install and configure a few other tools. We will also look at the customization of keyboard shortcuts.
Other tools
As noted here https://wiki.hyprland.org/Useful-Utilities/Must-have/, you need an Authentication Agent:
Authentication agents are the things that pop up a window asking you for a password whenever an app wants to elevate its privileges.
Let’s install the suggested one:
1 |
sudo pacman -S polkit-kde-agent |
And then we start it in the Hyprland configuration file with the “exec-once” directive:
1 |
exec-once = /usr/lib/polkit-kde-authentication-agent-1 |
Let’s restart Hyprland (such a change in the configuration file needs a restart), e.g., with the default shortcut SUPER + M, we exit Hyprland, and then we can log back in. When a program needs to elevate its privileges, we get the KDE dialog. For example, if we use the EndeavourOS Welcome App to update the mirrors, we get the dialog as soon as the mirror file must be saved:
The same happens if we run from a terminal a “systemctl” command that needs superuser privileges:
Having the authentication dialog tiled as the other windows is not ideal. So let’s create a Window rule in the Hyprland configuration to make it floating:
1 |
windowrulev2 = float,class:^(org.kde.polkit-kde-authentication-agent-1)$ |
TIP: to know the values for “class”, you can use “hyprctl clients” when the desired application is running and inspect its output by looking for the “class:” part.
Keyboard shortcuts
Hyprland is about using keyboard shortcuts a lot. You might want to take some time to get familiar with the main keyboard shortcuts for launching and closing (look at the configuration file). Change them as you see fit if you don’t like the default ones.
These are the default ones as set in the example configuration we started with:
1 2 3 4 5 6 7 8 9 10 11 12 |
# See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, Q, exec, kitty bind = $mainMod, C, killactive, bind = $mainMod, M, exit, bind = $mainMod, E, exec, nemo bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, wofi --show drun bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle |
I prefer these (note that SUPER+Q now has an entirely different behavior):
1 2 3 4 5 6 7 8 9 |
bind = $mainMod SHIFT, R, exec, hyprctl reload bind = $mainMod, D, exec, wofi --show drun bind = $mainMod SHIFT, Return, exec, nemo bind = $mainMod SHIFT, F, togglefloating bind = $mainMod, F, fullscreen bind = $mainMod, Q, killactive, bind = $mainMod, Return, exec, kitty bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle |
Some additional shortcuts might be helpful as well, such as the following (“grouping” has to do with tabbed windows):
1 2 3 4 5 6 7 8 |
# For grouping (tabbed windows) bind = $mainMod, G, togglegroup bind = $mainMod, tab, changegroupactive, f bind = $mainMod SHIFT, tab, changegroupactive, b # For workspaces bind = ALT, tab, workspace, m+1 bind = ALT SHIFT, tab, workspace, m-1 |
And for moving tiled windows:
1 2 3 4 5 |
# Move bind = $mainMod CTRL, H, movewindow, l bind = $mainMod CTRL, L, movewindow, r bind = $mainMod CTRL, K, movewindow, u bind = $mainMod CTRL, J, movewindow, d |
Mouse gestures
Hyprland provides mouse gestures (swipe) for switching among workspaces. This is not enabled by default, but it’s easy to do: change the existing “gestures” section as follows:
1 2 3 4 5 |
gestures { # See https://wiki.hyprland.org/Configuring/Variables/ for more workspace_swipe = true workspace_swipe_fingers = 3 } |
Screenshots
Let’s configure the system to take screenshots.
First, we install “grim” (A screenshot utility for Wayland)
1 |
sudo pacman -S grim |
Let’s also install an image viewer, like “Eye of Gnome”:
1 |
sudo pacman -S eog |
You can try to run “grim” from a terminal to see how it works: by default, it takes a screenshot of the whole screen and save the corresponding images with names containing date and time in the “Pictures” folder. For example, after running “grim” twice, I get the following:
1 2 3 4 5 |
$ ll Pictures/ total 272 drwxr-xr-x 1 bettini bettini 108 12 mag 17.52 . -rw-r--r-- 1 bettini bettini 130333 12 mag 17.51 20230512_17h51m54s_grim.png -rw-r--r-- 1 bettini bettini 146018 12 mag 17.52 20230512_17h52m41s_grim.png |
What if we want to take a screenshot of a region? We need another program, “slurp” (Select a region in a Wayland compositor)
1 |
sudo pacman -S slurp |
And we configure a few key bindings (note the last one, which takes a screenshot of the currently active window: this requires several commands to get the active window through Hyprland and then compute a few screen coordinates to pass to “grim”):
1 2 3 4 5 6 |
# Screenshots bind = , Print, exec, grim # with selection bind = CTRL, Print, exec, grim -g "$(slurp)" # current window (pos and size) bind = ALT, Print, exec, grim -g "$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1) $(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)" |
Brightness and volume
How to set the screen’s brightness and volume through the corresponding keys?
First, install “brightnessctl”:
1 |
sudo pacman -S brightnessctl |
You can get the current brightness by simply running the program (or with “get” or “-m”) and changing it with the “set” and the value (e.g., increase/decrease by percentage). For example:
1 2 3 |
brightnessctl set 10%+ brightnessctl set 10%- |
So, we need to bind the appropriate special keys to such commands:
1 2 3 |
# Special Keys bind = , xf86monbrightnessup, exec, brightnessctl set 10%+ bind = , xf86monbrightnessdown, exec, brightnessctl set 10%- |
For volume, we do something similar: assuming that “wireplumber” is installed, we use “wpctl”:
1 2 3 |
bind = , xf86audioraisevolume, exec, wpctl set-volume -l 1.0 @DEFAULT_SINK@ 5%+ bind = , xf86audiolowervolume, exec, wpctl set-volume -l 1.0 @DEFAULT_SINK@ 5%- bind = , xf86audiomute, exec, wpctl set-mute @DEFAULT_SINK@ toggle |
Note the use of “-l 1.0” meaning that we don’t want to allow the wireplumber to increase the volume above 100%.
Screen locking
If we want to have screen locking (using a keyboard shortcut), we need these two programs:
- swayidle, Idle management daemon for Wayland
- swaylock, Screen locker for Wayland
1 |
sudo pacman -S swayidle swaylock |
And then, configure the shortcuts (note that we define a variable, $lock, in the configuration file):
1 2 3 4 5 6 |
# Screensaver and lock screen $lock = swaylock -f --color 1e1e2eFF exec-once = swayidle -w timeout 300 '$lock' timeout 300 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep '$lock' # Screenlock bind = $mainMod, L, exec, $lock |
Now, when we press SUPER + L, the screen is locked (swaylock can be configured with colors and the like, but I won’t discuss that). You have to type your password: when you start doing that, you’ll see a circle with some parts changing. If you get the password wrong, swaylock will notify you.
The “exec-once” (remember, you need to restart Hyprland for that) will lock the screen after 300 seconds, but it will also turn it off using a “hyprctl” dispatch command. Note that when that happens, you need to press a key or move the mouse, and the instruction above instructs the system to turn the screen back on. Of course, then you’ll have to type your password.
That’s all for now! Stay tuned for more posts about Hyprland 🙂
Very nice to read your travels whilst I’m editing my hyprland config. And of course a fellow user of Nemo, even in WM land 😉
To be honest, I’m not a big fan of Nemo, probably my favorite file manager is Dolphin.
However, I still prefer Nemo to Thunar, which does not provide a tree view in the main window.
I have also tested Nautilus in Hyprland as well, and it works great.
I really appreciate the part 2 as it is helping me with my own Hyprland setup on my Macbook Pro 8,1.
However, I’m a little stuck on getting Nemo to access my smb/cifs NAS as it’s currently configured. I can switch to Dolphin to get smb/cifs working there, but not my first choice as Dolphin looks really bad in this base configuration.
My next questions is about building a system with both KDE Plasma and Hyprland so I can choose during login on the SDDM window. Any thoughts on doing that?
Jim, I never used smb/cifs, so I’m afraid I cannot help here. If you don’t want to switch to Dolphin, you could still consider Nautilus.
Concerning several DEs in the same OS: I did tons of experiments in the past. It’s possible, but you should ALWAYS use a different user for each different DE, or you’ll get into troubles with user’s configuration. Moreover, you should remember to disable services from the DEs you’re not using. For example, when you use Gnome, you should remember to disable “baloo”. Similarly for “tracker” when you use Gnome. Hyprland might make things worse because of the “portal” package (see the wiki): you should uninstall the other portals.
Long story short: it’s not very feasible/comfortable to have several DEs in the same installation :'(
Thanks, I found that installing the package breeze-icons makes Dolphin look good enough to use so I’ll go that direction for now.
I also stole the Sreen brightness ctl and volume control stuff from the Endeavour OS i3wm implementation. It gives you visual feedback when changing the brightness or volume with a popup notification.
I’ve not used Linux for a good 10+ years, but have recently made the switch back, handing over my MacOS device to my wife to ensure I never get it back again 🙂
This is been an excellent series for me. Coming back I’ve wondered what all the fuss is about tiling window managers. While I am unsure I’m ready to put KDE away for good yet, these blog posts have helped me to get started with tiling to understand things quickly. Thank you so much for sharing.
glad you enjoyed it! 🙂
Stay tuned for more pots about Hyprland!
Outstanding site. Although I hold on to Budgie as a security blanket, Hyprland is clearly the best PC environment I have experienced in 35+ years. My first year with Linux has been a blast, in part, to your advice and experience.