SecondSonConsulting / Renew

A macOS script to encourage users to restart their workstations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add "assertions" functionality to avoid popups during Zoom/teams/powerpoint

SecondSonConsulting opened this issue · comments

we can use pmset -g to review assertions, need to parse the text output.

Pico provided some links:
https://www.brunerd.com/blog/2022/03/07/respecting-focus-and-meeting-status-in-your-mac-scripts-aka-dont-be-a-jerk/

Detect if the screen is awake:
if [[ "$(osascript -l 'JavaScript' -e 'ObjC.import("CoreGraphics"); $.CGDisplayIsActive($.CGMainDisplayID())')" == '1' ]]; then

And this detects if the screen is unlocked:
if [[ "$(/usr/libexec/PlistBuddy -c 'Print :IOConsoleUsers:0:CGSSessionScreenIsLocked' /dev/stdin <<< "$(ioreg -ac IORegistryEntry -k IOConsoleUsers -d 1)" 2> /dev/null)" != 'true' ]]; then