You are not logged in.

#1 2019-11-07 17:26:51

koltea
Member
Registered: 2019-10-09
Posts: 5

[Solve] Problems with i3lock to be use as lock when system sleeps

hi i want to make my i3lock.sh script to be used when system goes to sleep

first i created i3lock.service

[Unit]
Description=Lock screen before suspend
Before=sleep.target

[Service]
User=koltea
Type=forking
Environment=DISPLAY=:0
ExecStart=/home/koltea/.scripts/i3lock.sh

[Install]
WantedBy=sleep.target

and here is my i3lock.sh

#!/bin/bash

pngfile="/tmp/screen_locked.png"

scrot  $pngfile
convert $pngfile -blur 0x10 $pngfile
i3lock -i $pngfile
rm $pngfile

then i enable with systemctl enable i3lock.service
and do a test if it works with systemctl start i3lock.service and it works fine with lock and blur background

but when my system goes to sleep it uses the i3lock with white background only, what i would like to do is set
it the same with my script the one with blur background

can anyone please help me, or point me to the right guide to follow tia

edit
i just add to my script

sleep 2; pgrep i3lock && xset dpms force off

then on my i3 config

exec --no-startup-id xautolock -time 2 -locker '~/.scripts/i3lock.sh' &

Last edited by koltea (2019-11-07 19:28:00)

Offline

Board footer

Powered by FluxBB