forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdnd-on.sh
executable file
·38 lines (28 loc) · 991 Bytes
/
dnd-on.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Dependency: do-not-disturb-cli (https://github.com/sindresorhus/do-not-disturb-cli)
# Install via npm: `npm install --global do-not-disturb-cli`
## Contributions welcome for a reliable, dependency-free version.
# @raycast.title Turn On Do Not Disturb
# @raycast.author Caleb Stauffer
# @raycast.authorURL https://github.com/crstauf
# @raycast.description Turn on "do not disturb" mode. Does [not work on Big Sur](https://github.com/sindresorhus/do-not-disturb-cli/issues/2).
# @raycast.icon 😴
# @raycast.mode silent
# @raycast.packageName System
# @raycast.schemaVersion 1
if ! command -v do-not-disturb &> /dev/null; then
echo "do-not-disturb-cli is required (https://github.com/sindresorhus/do-not-disturb-cli).";
exit 1;
fi
status=$(do-not-disturb status)
if [[ $status = "on" ]]; then
echo "DND already on"
exit 0
fi
do-not-disturb on
status=$(do-not-disturb status)
if [[ $status = "on" ]]; then
echo "Turned DND on"
else
echo "Unable to turn DND on"
fi