Hyprland: getting started (part 2)

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:

And then we start it in the Hyprland configuration file with the “exec-once” directive:

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:

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:

I prefer these (note that SUPER+Q now has an entirely different behavior):

Some additional shortcuts might be helpful as well, such as the following (“grouping” has to do with tabbed windows):

And for moving tiled windows:

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:

Screenshots

Let’s configure the system to take screenshots.

First, we install “grim” (A screenshot utility for Wayland)

Let’s also install an image viewer, like “Eye of Gnome”:

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:

What if we want to take a screenshot of a region? We need another program, “slurp” (Select a region in a Wayland compositor)

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”):

Brightness and volume

How to set the screen’s brightness and volume through the corresponding keys?

First, install “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:

So, we need to bind the appropriate special keys to such commands:

For volume, we do something similar: assuming that “wireplumber” is installed, we use “wpctl”:

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

And then, configure the shortcuts (note that we define a variable, $lock, in the configuration file):

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 🙂

8 thoughts on “Hyprland: getting started (part 2)

  1. Mark

    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 😉

    Reply
    1. Lorenzo Bettini Post author

      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.

      Reply
  2. Jim Abernathy

    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?

    Reply
    1. Lorenzo Bettini Post author

      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 :'(

      Reply
  3. Jim Abernathy

    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.

    Reply
  4. Rob

    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.

    Reply
  5. Mark

    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.

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.