mirror of
https://github.com/mtan93/Installomator.git
synced 2026-04-02 22:04:27 +01:00
Added option to not interrupt Do Not Disturb full screen apps like KeyNote or Zoom
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
- Added bunch of new labels, and improved others.
|
- Added bunch of new labels, and improved others.
|
||||||
- Renamed `buildCaseStatement.sh` to `buildLabel.sh` and improved it a lot. It is a great start when figuring out how to create a new label for an app, or a piece of software. Look at the tutorials in our wiki.
|
- Renamed `buildCaseStatement.sh` to `buildLabel.sh` and improved it a lot. It is a great start when figuring out how to create a new label for an app, or a piece of software. Look at the tutorials in our wiki.
|
||||||
- Mosyle changed their app name from Business to Self-Service
|
- Mosyle changed their app name from Business to Self-Service
|
||||||
|
- Added option to not interrupt Do Not Disturb full screen apps like KeyNote or Zoom with `INTERRUPT_DND="no"`.
|
||||||
|
|
||||||
## v0.6 - 2021-07-14
|
## v0.6 - 2021-07-14
|
||||||
|
|
||||||
|
|||||||
@@ -616,4 +616,30 @@ finishing() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Detect if there is an app actively making a display sleep assertion, e.g.
|
||||||
|
# KeyNote, PowerPoint, Zoom, or Webex.
|
||||||
|
# See: https://developer.apple.com/documentation/iokit/iopmlib_h/iopmassertiontypes
|
||||||
|
hasDisplaySleepAssertion() {
|
||||||
|
# Get the names of all apps with active display sleep assertions
|
||||||
|
local apps="$(/usr/bin/pmset -g assertions | /usr/bin/awk '/NoDisplaySleepAssertion | PreventUserIdleDisplaySleep/ && match($0,/\(.+\)/) && ! /coreaudiod/ {gsub(/^.*\(/,"",$0); gsub(/\).*$/,"",$0); print};')"
|
||||||
|
|
||||||
|
if [[ ! "${apps}" ]]; then
|
||||||
|
# No display sleep assertions detected
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create an array of apps that need to be ignored
|
||||||
|
local ignore_array=("${(@s/,/)IGNORE_DND_APPS}")
|
||||||
|
|
||||||
|
for app in ${(f)apps}; do
|
||||||
|
if (( ! ${ignore_array[(Ie)${app}]} )); then
|
||||||
|
# Relevant app with display sleep assertion detected
|
||||||
|
printlog "Display sleep assertion detected by ${app}."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# No relevant display sleep assertion detected
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,16 @@ REOPEN="yes"
|
|||||||
# - no App not reopened
|
# - no App not reopened
|
||||||
|
|
||||||
|
|
||||||
|
# Interrupt Do Not Disturb (DND) full screen apps
|
||||||
|
INTERRUPT_DND="yes"
|
||||||
|
# options:
|
||||||
|
# - yes Script will run without checking for DND full screen apps.
|
||||||
|
# - no Script will exit when an active DND full screen app is detected.
|
||||||
|
|
||||||
|
# Comma separated list of app names to ignore when evaluating DND
|
||||||
|
IGNORE_DND_APPS="firefox,Google Chrome,Safari,Microsoft Edge,Opera,Amphetamine,caffeinate"
|
||||||
|
|
||||||
|
|
||||||
# NOTE: How labels work
|
# NOTE: How labels work
|
||||||
|
|
||||||
# Each workflow label needs to be listed in the case statement below.
|
# Each workflow label needs to be listed in the case statement below.
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ esac
|
|||||||
|
|
||||||
# MARK: application download and installation starts here
|
# MARK: application download and installation starts here
|
||||||
|
|
||||||
|
if [[ ${INTERRUPT_DND} = "no" ]]; then
|
||||||
|
# Check if a fullscreen app is active
|
||||||
|
if hasDisplaySleepAssertion; then
|
||||||
|
cleanupAndExit 1 "active display sleep assertion detected, aborting"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
printlog "BLOCKING_PROCESS_ACTION=${BLOCKING_PROCESS_ACTION}"
|
printlog "BLOCKING_PROCESS_ACTION=${BLOCKING_PROCESS_ACTION}"
|
||||||
printlog "NOTIFY=${NOTIFY}"
|
printlog "NOTIFY=${NOTIFY}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user