by moviuro · 7y ago · 0 comments
while IFS= read -r line; do
if printf '%s\n' "$line" | grep [something here]; then
# lock screen
elif printf '%s\n' "$line" | grep [something else here]; then
# unlock screen
fi
done <<< "$(dmesg -w)" ACTION=="remove", ENV{ID_SERIAL}=="Pixel_3_0a7...", RUN+="/usr/bin/screensaver-lock-script"
To find out your phone's ID_SERIAL string, run this then plug in: udevadm monitor -up