A Swift 4 script to set the Mac do not disturb feature for a configurable number of minutes, defaults to 30.
- For Mac OS (OS X), obviuosly
- Use the executable or build the project with Xcode
- Copy the executable to
/usr/local/bin
- Run from terminal using eg:
dndtime 55
to turn on do not disturb for 55 minutes- Calling with no argument sets the default do not disturb time, 30 minutes
- Calling with
off
or0
, disables do not disturb
- This is based on code from this SO answer, I just added the functionality to set the do not disturb duration and made it executable.
I hope you've found this useful