Comment 132 for bug 1574120

Revision history for this message
Bob (caltinay) wrote :

@unusedusername I found a snippet somewhere that helped me do things when my lid is closed (or rather when the session is locked). Since your laptop switches to airplane mode something is detecting it so maybe this helps. Put this in a script and run it, then close lid and open lid. Do you get any output?

<snip>
#!/bin/sh
iface=org.freedesktop.login1.Session
dbus-monitor --system --profile "type=signal,interface=$iface" 2>/dev/null |
 while read type stamp sender dest path intf member; do
  case "$member" in
    *Lock)
        date
        echo LOCKED at $stamp ;;
    *Unlock)
        date
        echo UNLOCKED at $stamp ;;
    *)
  esac
done

</snip>

If it works you could even insert a suspend command and run this in the background to avoid having to use the mouse.