#!/bin/sh # pkill -USR1 xidle # Get the current Xsession user _user=$(ps -o user= -p $(pgrep -f Xsession)) pkill xlock # Run xlock as the Xsession user doas -u $_user env DISPLAY=:0 XAUTHORITY=/home/$_user/.Xauthority slock &