hyprlock

hyprlock is a simple, yet fast, multi-threaded and GPU-accelerated screen lock for Hyprland.

Configuration

Configuration is done via the config file at ~/.config/hypr/hyprlock.conf. This file must exist to run hyprlock.

Variable types

Hyprlock uses the following types in addition to Hyprland’s variable types.

typedescription
layoutxyvec2 with an optional % suffix, allowing users to specify sizes as percentages of the output size. Floats (e.g. 10.5) are supported, but only have an effect when used with %. Raw pixel values will just get rounded.

General

Variables in the general category:

variabledescriptiontypedefault
disable_loading_bardisables the loading bar on the bottom of the screen while hyprlock is booting up.boolfalse
hide_cursorhides the cursor instead of making it visibleboolfalse
gracethe amount of seconds for which the lockscreen will unlock on mouse movement.int0
ignore_empty_inputskips validation when no password is providedboolfalse
immediate_rendermakes hyprlock immediately start to draw widgets. Backgrounds will render background:color until their background:path resource is availableboolfalse
text_trimsets if the text should be trimmed, useful to avoid trailing newline in commands outputbooltrue
fractional_scalingwhether to use fractional scaling. 0 - disabled, 1 - enabled, 2 - autoint2
screencopy_modeselects screencopy mode. 0 - gpu accelerated, 1 - cpu based (slow)int0
⚠️
If you are not on hyprland, or your XDG_CURRENT_DESKTOP is not Hyprland, the fade out will be disabled and the value of your no_fade_out variable will be ignored.

Authentication

Variables in the auth category:

variabledescriptiontypedefault
pam:enabledwhether to enable pam authenticationbooltrue
pam:modulesets the pam module used for authentication. If the module isn’t found in /etc/pam.d, “su” will be used as a fallbackstrhyprlock
fingerprint:enabledenables parallel fingerprint auth with fprintd.boolfalse
fingerprint:ready_messagesets the message that will be displayed when fprintd is ready to scan a fingerprint.str(Scan fingerprint to unlock)
fingerprint:present_messagesets the message that will be displayed when a finger is placed on the scanner.strScanning fingerprint
ℹ️
At least one enabled authentication method is required.

Animations

Variables in the animations category:

variabledescriptiontypedefault
enabledwhether to enable animationsbooltrue

Keywords

The animation and bezier keywords can be used just like in hyprland.conf.

For Example:

bezier = linear, 1, 1, 0, 0
animation = fade, 1, 1.8, linear

Available animations can be found in the animation tree. The optional STYLE parameter for the animation keyword is currently unused by hyprlock.

Check out Hyprland’s animation documentation for more information.

Animation tree

global
  ↳ fade
    ↳ fadeIn - fade to lockscreen
    ↳ fadeOut - fade back to the wayland session
  ↳ inputField
    ↳ inputFieldColors - fade between colors and gradients
    ↳ inputFieldFade - fade_on_empty animation
    ↳ inputFieldWidth - adaptive width animation
    ↳ inputFieldDots - fade in/out for individual dots in the input field

Keyboard Shortcuts and Actions

The following keys and key-combinations describe hyprlock’s default behaviour:

inputdescription
ESCClear password buffer
Ctrl + uClear password buffer
Ctrl + BackspaceClear password buffer

Widgets

The entire configuration of how hyprlock looks is done via widgets.

widget_name {
    monitor =
    # further options
}

Monitor selection

monitor is available for all widgets and can be left empty for “all monitors”.

It takes the same string that is used reference monitors in the hyprland configuration. So either use the portname (e.g. eDP-1) or the monitor description (e.g. desc:Chimei Innolux Corporation 0x150C).

See Monitors.

Variable substitution

The following variables in widget text options will be substituted.

  • $USER - username (e.g. linux-user)
  • $DESC - user description (e.g. Linux User)
  • $TIME - current time in 24-hour format (e.g. 13:37)
  • $TIME12 - current time in 12-hour format (e.g. 1:37 PM)
  • $LAYOUT - current keyboard layout
  • $ATTEMPTS - failed authentication attempts
  • $FAIL - last authentication fail reason
  • $PAMPROMPT - pam auth last prompt
  • $PAMFAIL - pam auth last fail reason
  • $FPRINTPROMPT - fingerprint auth last prompt
  • $FPRINTFAIL - fingerprint auth last fail reason

Widget List

General remarks

  • All rendered text supports pango markup.
    • Additionally hyprlock will parse <br/> for your convenience. (That’s a linebreak) Remember to enable linebreaks in your spans with allow_breaks="true".
  • Positioning is done via halign, valign, position, and zindex. Position is an added offset to the result of alignment.
    • halign: left, center, right, none. valign: top, center, bottom, none
    • zindex: Widgets with larger numbers will be placed above widgets with smaller numbers. All widgets default to 0, except background which defaults to -1.
  • All position and size options can be specified in pixels or as percentages of the output size.
    • pixels: 10, 10 or 10px, 10px
    • percentages: 10%, 10.5%
    • mixed: 10%, 5px
  • Supported image formats are png, jpg and webp (no animations though)

Shadowable

Some widgets are shadowable, meaning they can have a shadow. For those widgets, you get:

variabledescriptiontypedefault
shadow_passespasses for shadow, 0 to disableint0
shadow_sizesize for shadowint3
shadow_colorshadow colorcolorrgb(0,0,0)
shadow_boostboost shadow’s opacityfloat1.2

Background

Draws a background image or fills with color.

If path is empty or missing, will use color. Otherwise, the image will be used.

If path is screenshot, a screenshot of your desktop at launch will be used.

variabledescriptiontypedefault
monitormonitor to draw onstr[[Empty]]
pathimage path, screenshot or empty to fill with colorstr[[Empty]]
colorfallback background colorcolorrgba(17, 17, 17, 1.0)
blur_passesthe amount of passes to perform. 0 disables blurringint0
blur_sizeblur size (distance)int7
noisehow much noise to applyfloat0.0117
contrastcontrast modulation for blurfloat0.8916
brightnessbrightness modulation for blurfloat0.8172
vibrancyIncrease saturation of blurred colorsfloat0.1696
vibrancy_darknessHow strong the effect of vibrancy is on dark areasfloat0.05
reload_timeseconds between reloading, 0 to reload with SIGUSR2. Ignored if path is screenshot.int-1
reload_cmdcommand to get new path. If empty, old path will be used.str[[Empty]]
crossfade_timecross-fade time in seconds between old and new background on reload. A negative value means no cross-fade.float-1.0
zindexz-index of the widgetint-1
ℹ️
Blur options are taken from hyprland. See Variables/#blur.
Example background
background {
    monitor =
    path = screenshot
    color = rgba(25, 20, 20, 1.0)
    blur_passes = 2
}

Image

✓ Shadowable

Draws an image.

If path is empty or missing, nothing will be shown.

variabledescriptiontypedefault
monitormonitor to draw onstr[[Empty]]
pathimage pathstr[[Empty]]
sizesize scale based on the lesser side of the imageint150
roundingnegative values result in a circleint-1
border_sizeborder sizeint0
border_colorborder colorgradientrgba(221, 221, 221, 1.0)
rotaterotation in degrees, counter-clockwiseint0
reload_timeseconds between reloading, 0 to reload with SIGUSR2int-1
reload_cmdcommand to get new path. if empty, old path will be used. don’t run “follow” commands like tail -Fstr[[Empty]]
positionposition of the imagelayoutxy0, 0
halignhorizontal alignmentstrcenter
valignvertical alignmentstrcenter
zindexz-index of the widgetint0
Example image
image {
    monitor =
    path = /home/me/cutie.png
    size = 150
    rounding = 0 # no rounding

    position = 0, 200
    halign = center
    valign = center
}

Shape

✓ Shadowable

Draws a shape.

variabledescriptiontypedefault
monitormonitor to draw onstr[[Empty]]
sizesize of the shapelayoutxy100, 100
colorcolor of the shapecolorrgba(17, 17, 17, 1.0)
roundingnegative values result in a circleint-1
rotaterotation in degrees, counter-clockwiseint0
border_sizeborder sizeint0
border_colorborder colorgradientrgba(0, 207, 230, 1.0)
xrayif true, make a “hole” in the background (rectangle of specified size, no rotation)boolfalse
positionposition of the shapelayoutxy0, 0
halignhorizontal alignmentstrcenter
valignvertical alignmentstrcenter
zindexz-index of the widgetint0
Example shape
shape {
    monitor =
    size = 360, 60
    color = rgba(0, 0, 0, 0.0) # no fill
    rounding = -1 # circle
    border_size = 4
    border_color = rgba(0, 207, 230, 1.0)

    position = 0, 80
    halign = center
    valign = center
}

Input Field

✓ Shadowable

Draws a password input field.

variabledescriptiontypedefault
monitormonitor to draw onstr[[Empty]]
sizesize of the input field.layoutxy400, 90
outline_thicknessthickness of the outlineint4
dots_sizesize of the dots. [0.2 - 0.8]float0.25
dots_spacingspacing between dots. [-1.0 - 1.0]float0.15
dots_centerwhether to center the dots. align left otherwisebooltrue
dots_roundingrounding of the dotsint-1
dots_text_formattext character(s) used for the input indicator, rounded rectangles are the default.str[[Empty]]
outer_colorborder colorgradientrgba(17, 17, 17, 1.0)
inner_colorcolor of the inner boxcolorrgba(200, 200, 200, 1.0)
font_colorcolor of the fontcolorrgba(10, 10, 10, 1.0)
font_familyfont familystrNoto Sans
fade_on_emptyfade the input field when emptybooltrue
fade_timeoutmilliseconds before fade_on_empty is triggeredint2000
placeholder_texttext rendered in the input box when it’s emptystr<i>Input Password...</i>
hide_inputrender an input indicator similar to swaylock instead of dots when set to trueboolfalse
rounding-1 means complete rounding (circle/oval)int-1
check_colorcolor accent when waiting for the authentication resultgradientrgba(204, 136, 34, 1.0)
fail_colorcolor accent when authentication failsgradientrgba(204, 34, 34, 1.0)
fail_texttext rendered when authentication failsstr<i>$FAIL <b>($ATTEMPTS)</b></i>
fail_timeoutmilliseconds before fail_text and fail_color disappearsint2000
capslock_colorcolor accent when capslock is activegradient[[Empty]]
numlock_colorcolor accent when numlock is activegradient[[Empty]]
bothlock_colorcolor accent when both locks are activegradient[[Empty]]
invert_numlockchange color if numlock is offboolfalse
swap_font_colorswap font and inner colors on color change eventsboolfalse
positionposition of the input fieldlayoutxy0, 0
halignhorizontal alignmentstrcenter
valignvertical alignmentstrcenter
zindexz-index of the widgetint0
ℹ️

Colors information

When outline_thickness set to 0, the color of the inner box will be changed instead of the outer.

Behaviour of swap_font_color is as follows:

  • outline_thickness is 0: if set, font color will be swapped with inner one on color change events (e.g. Caps-lock on or password check).
  • outline_thickness is not 0: if set, font and inner colors will be swapped on password check and authentication failure.
  • swap_font_color will narrow the accent colors from a gradient to a single color by using the first specified color.

placeholder_text and fail_text both support variable substitution.

Example input-field
input-field {
    monitor =
    size = 20%, 5%
    outline_thickness = 3
    inner_color = rgba(0, 0, 0, 0.0) # no fill

    outer_color = rgba(33ccffee) rgba(00ff99ee) 45deg
    check_color=rgba(00ff99ee) rgba(ff6633ee) 120deg
    fail_color=rgba(ff6633ee) rgba(ff0066ee) 40deg

    font_color = rgb(143, 143, 143)
    fade_on_empty = false
    rounding = 15

    position = 0, -20
    halign = center
    valign = center
}

Label

✓ Shadowable

Draws a label.

variabledescriptiontypedefault
monitormonitor to draw onstr[[Empty]]
texttext to renderstrSample Text
text_alignmulti-line text alignment inside label container. center/right or any value for default left.strcenter
colorcolor of the textcolorrgba(254, 254, 254, 1.0)
font_sizesize of the fontint16
font_familyfont familystrSans
rotaterotation in degrees, counter-clockwiseint0
positionposition of the labellayoutxy0, 0
halignhorizontal alignmentstrcenter
valignvertical alignmentstrcenter

Dynamic labels

The text option supports variable substitution and launching shell commands. For example:

text = cmd[update:1000] echo "<span foreground='##ff2222'>$(date)</span>"

Worth noting:

  • update: - time is in ms.
  • label can be forcefully updated by specifying update:<time>:1 or update:<time>:true and sending SIGUSR2 to hyprlock. <time> can be 0 in this case.
  • $ATTEMPTS[<string>] format can be used to show <string> when there are no failed attempts. You can use pango-markup here. <string> can be empty to hide.
  • $LAYOUT[<str0>,<str1>,...] format is available to replace indexed layouts. You can use settings from hyprland.conf, e.g. $LAYOUT[en,ru,de]. Also, single ! character will hide layout. E.g. $LAYOUT[!] will hide default (0 indexed) and show others.
  • $TIME and $TIME12 will use timezone from TZ environment variable. If it’s not set, system timezone will be used, falling back to UTC in case of errors.
  • Variables seen above are parsed before the command is ran.
  • do not run commands that never exit. This will hang the AsyncResourceGatherer and you won’t have a good time.
Example label
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
}

User Signals

  • SIGUSR1 - unlocks hyprlock. For example, you can switch to a another tty and run pkill -USR1 hyprlock.
  • SIGUSR2 - updates labels and images. See above.