You are not logged in.

#1 2020-07-18 05:19:12

pvsakith
Member
Registered: 2020-04-28
Posts: 18

How to set up custom lock and xss-lock to work on i3?

Hello,

I am using i3wm on Arch Linux. I set xss-lock to be auto start through i3 config. I use a fork of i3lock called i3lock-fancy to lock the machine. Since I am on a laptop I need to be able to run a script when the lid is closed. That script basically does is lock the screen and suspend the machine.

The line in i3 config.

exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/lidclose.sh --nofork

lidclose.sh

playing = (`pacmd list-sink-inputs | grep -c 'state: RUNNING'`)

if [ $playing -eq 0 ]
then
	~/.config/i3/suspend.sh
else
	~/.config/i3/lock.sh
fi

logind.conf

HandleLidSwitch=ignore

When I close the lid it does nothing. And I also checked whether xss-lock is running and it is running.

What's wrong here. Please help with this.

Thank you.

Last edited by pvsakith (2020-07-18 05:20:24)

Offline

#2 2020-07-18 06:11:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,762

Re: How to set up custom lock and xss-lock to work on i3?

wiki wrote:

xss-lock
xss-lock subscribes to the systemd-events suspend, hibernate, lock-session, and unlock-session with appropriate actions (run locker and wait for user to unlock or kill locker). xss-lock also reacts to DPMS events and runs or kills the locker in response.

Where does the systemd event com from?

You might want to use acpid instead (because you want a conditional response to the HW event)

Offline

#3 2020-07-18 14:54:11

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: How to set up custom lock and xss-lock to work on i3?

pvsakith wrote:
playing = (`pacmd list-sink-inputs | grep -c 'state: RUNNING'`)

Is this supposed to be a shell script? Have you tested it at all? At a minimum, you need to remove the spaces around the '='.
And your usage of brackets and backticks makes very little sense. Please use "$(...)" instead.

Offline

#4 2020-07-19 17:07:40

pvsakith
Member
Registered: 2020-04-28
Posts: 18

Re: How to set up custom lock and xss-lock to work on i3?

Thanks however I resolved the issue by setting the HandleLidSwitch=lock. Idk how but it worked. No xss-lock will run my script.

Offline

Board footer

Powered by FluxBB