2

I try to set up a script to lock my screen when I unplug my Yubikey.

At the moment I am stuck with the correct way to send the command to lightdm.

That were my tries:

smiddy@3000-N200:~$ sudo su -
[sudo] password for smiddy: 
root@3000-N200:~# dm-tool lock
Not running inside a display manager, XDG_SEAT_PATH not defined
root@3000-N200:~# /bin/su smiddy -c "dm-tool lock"
Not running inside a display manager, XDG_SEAT_PATH not defined
root@3000-N200:~# $XDG_SEAT_PATH
root@3000-N200:~# echo $XDG_SEAT_PATH

root@3000-N200:~# XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
root@3000-N200:~# echo $XDG_SEAT_PATH
/org/freedesktop/DisplayManager/Seat0
root@3000-N200:~# dm-tool lock
Not running inside a display manager, XDG_SEAT_PATH not defined
root@3000-N200:~# /bin/su smiddy -c "dm-tool lock"
Not running inside a display manager, XDG_SEAT_PATH not defined
root@3000-N200:~# su smiddy
smiddy@3000-N200:/root$ dm-tool lock
Not running inside a display manager, XDG_SEAT_PATH not defined

It seems that the dm-tool does not recognize the active seat. But when I just fire up a terminal an send dm-tool lock the screen is locked.

1

To set an env var, you need to use export:

export XDG_SEAT_PATH="..."

printenv command prints env variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.