top of page
Search

Lock your Hyprland screen with Hyprlock

  • Writer: Chris
    Chris
  • Dec 16, 2024
  • 3 min read


This guide examines how to install Hyprlock on various Linux distributions, set it up efficiently, and integrate it with Hyprland. Whether you are experienced with Linux or just beginning, this guide covers everything you need to know.


Installation


Debian-based Distributions


To install Hyprlock on Debian-based distributions like Ubuntu, follow these steps:


  1. Open Terminal: Access the terminal from your applications menu or press `Ctrl+Alt+T`.


  2. Update Package List: Ensuring your package list is updated is crucial. Run:

sudo apt update

  1. Install Hyprlock: Use the following command to install:

sudo apt install hyprlock

Fedora-based Distributions


For Fedora and other RPM-based distributions, the steps vary slightly:


  1. Open Terminal: Access it as described above.


  2. Update Repository: Keep your repository updated:


sudo dnf upgrade

  1. Install Hyprlock: Enter the command to install:

sudo dnf install hyprlock

Arch Linux Distributions


Installing Hyprlock on Arch Linux is simple and can be done quickly:


  1. Open Terminal: Use your preferred method.


  2. Update System: Update your system with:

sudo pacman -Syu
  1. Install Hyprlock: Use this command for installation:

sudo pacman -S hyprlock

Configuration


Configuring Hyprlock for optimal performance is essential for tailoring it to your needs.


  1. Create the Configuration File: at `~/.config/hypr/hyprlock.conf`.


  2. Open it in your text editor:

sudo nano /etc/hyprlock/hyprlock.conf

Hyprlock Configuration File Breakdown


Here's a simple example of the hyprlock.conf file.

Your configuration may vary and be more minimalistic or even more feature rich.


background {
    monitor =
    path = /home/me/someImage.png   # supports png, jpg, webp
 							       # (no animations, though)
	color = rgba(25, 20, 20, 1.0)
	
	# all these options are taken from hyprland, 
	# see https://wiki.hyprland.org/Configuring/Variables/#blur 
	# for explanations

	blur_passes = 0 # 0 disables blurring
	blur_size = 7
	noise = 0.0117
	contrast = 0.8916
	brightness = 0.8172
	vibrancy = 0.1696
	vibrancy_darkness = 0.0
}

input-field {
    monitor =
	size = 200, 50
	outline_thickness = 3
	dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8
	dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0
	dots_center = false
	dots_rounding = -1 
	# -1 default circle, -2 follow input-field rounding
	outer_color = rgb(151515)
	inner_color = rgb(200, 200, 200)
	font_color = rgb(10, 10, 10)
	fade_on_empty = true
	fade_timeout = 1000 
	# Milliseconds before fade_on_empty is triggered.

	placeholder_text = <i>Input Password...</i> 
	# Text rendered in the input box when it's empty.

	hide_input = false
	rounding = -1 # -1 means complete rounding (circle/oval)

	check_color = rgb(204, 136, 34)
	fail_color = rgb(204, 34, 34) 
	# if authentication failed, changes outer_color and fail 
	# message color

	fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i> 
	# can be set to empty

	fail_transition = 300 
	# transition time in ms between normal outer_color and
	# fail_color

	capslock_color = -1
	numlock_color = -1
	bothlock_color = -1 
	# when both locks are active. 
	# -1 means don't change outer color (same for above)

	invert_numlock = false # change color if numlock is off

	position = 0, -20

	halign = center
	valign = center
}

label {

	monitor =
	text = Hi there, $USER
	color = rgba(200, 200, 200, 1.0)
	font_size = 25
	font_family = Noto Sans
	position = 0, 80
	halign = center
	valign = center
}

Understanding the sections in the Hyprlock configuration file helps you customize it effectively:


  • Background: Set the background image of any given path to be displayed when the screen is locked.

    You can also set a color, a gradient, specify the display effects such as noise, vibrancy,

    and contrast, brightness

  • Input field: This is where you type the password to unlock the screen.

You can specify the font, its size, color of the various items composing the field,

the position of the field etc.


  • Label: this is the text to be displayed in the lock screen.

    You can define font, font-size, transparency position, etc.



Integrating Hyprlock with Hyprland


All you need to do to use Hyprlock with Hyprland is to add a keybinding in your hyprland.conf file.


This line below is the line you need to add if you want to lock your screen by pressing the

SUPER key + the L key.


Note: this is an example, you can set the keybinding to any value is fit for you.

bind = SUPER, L, exec, hyprlock

Conclusion

Hyprlock is an easy-to-use utility that helps you to lock your screen and it's fully flexible and customizable.


The Hyprlock wiki's can be found here.



Comments


bottom of page