
Dependencies:
grim: to take screenshot.ImageMagick: to edit image.
-
Create script
~/.local/bin/lock_screen.shwith content:#!/bin/bash # Take screenshot grim /tmp/screen.png # Pixelate it convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png # Optional: Add a overlay image at center # convert /tmp/screen.png <your_image> -gravity center -composite -matte /tmp/screen.png # Lock screen hyprlock -
Add execute permission:
chmod +x ~/.local/bin/lock_screen.sh -
Edit
~/.config/hypr/hyprlock.confto use/tmp/screen.pngfor background:background { path = /tmp/screen.png } -
Edit
~/.config/hypr/hyprland.confto uselock_screen.shwhen press Window+L:# Lock screen when press $mainMod + L bind = $mainMod, L, exec, ~/.local/bin/lock_screen.sh -
Edit
~/.config/hypr/hypridle.confto uselock_screen.shfor lock command:general { lock_cmd = pidof hyprlock | ~/.local/bin/lock_screen.sh before_sleep_cmd = loginctl lock-session after_sleep_cmd = hyprctl dispatch dpms on } listener { timeout = 300 on-timeout = loginctl lock-session } listener { timeout = 360 on-timeout = hyprctl dispatch dpms off on-resume = hyprctl dispatch dpms on }
Comments