jomifepe / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
0 stars 0 forks source link

Investigate auto-locking vault when locking mac #14

Open jomifepe opened 1 year ago

jomifepe commented 1 year ago

https://github.com/raycast/extensions/issues/4113

jomifepe commented 1 year ago

Update:

  1. Raycast doesn't provide any information about the last lock date or lock status via its API
  2. With Swift, we can listen to lock events by observing com.apple.screenIsLocked, but since this requires a listener, and Raycast extensions are short-lived, and menu bar commands have a refresh interval, this is not a viable option
  3. The last lock date seems to only be available in the system logs, for example, by executing the following command:
    • log show --style syslog --predicate "process == 'loginwindow'" --debug --info --last 1d | grep "sending unlock success" | tail -n 1
    • Although, this requires a --last parameter, and the higher the time range, the longer the command takes to execute. Also, because of this parameter, it's impossible to guarantee that we can always get the last lock (e.g. parameter of 1d on a machine that hasn't been locked for a whole day).
jomifepe commented 1 year ago

Update: