Ok, so just in case anyone else needs this, that’s how I did it.
- As instructed above, I monitor the output of
xscreensaver-command -watch
and send mosquitto_pub
command to a VM that has local connectivity (wg-tailscale
):
#!/bin/bash
while read line
do
[[ $line =~ ^LOCK ]] && STATE='locked'
[[ $line =~ ^UNBLANK ]] && STATE='unlocked'
CMD=(qvm-run -p wg-tailscale "'"mosquitto_pub -h my_mqtt_host -t qubes-comupter-name/lock_status -m $STATE"'")
echo "${CMD[@]}"|sh
done < <(/usr/bin/xscreensaver-command -watch)
(I know echo ...|sh
is ugly, but my brain fried while trying to figure out another way)
- To make it auto-start I created this
qubes-monitor-screenlock.desktop
file in .config/autostart
of dom0:
[Desktop Entry]
Type=Application
Name=ScreenLockMon
Exec=/home/chuck/screenlock_monitor.sh
StartupNotify=true
Terminal=false