Skip to content

Commit 1a4187e

Browse files
authored
Update Do Not Disturb command (raycast#624)
* Update Do Not Disturb command * Update shebang
1 parent 86c0f90 commit 1a4187e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

commands/system/do-not-disturb.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Dependency: This script requires `calm-notifications` cli installed: https://github.com/vitorgalvao/tiny-scripts/blob/master/calm-notifications
44
# Install via homebrew: `brew install vitorgalvao/tiny-scripts/calm-notifications`
@@ -11,18 +11,19 @@
1111
# Optional parameters:
1212
# @raycast.icon 🔕
1313
# @raycast.packageName System
14-
# @raycast.argument1 { "type": "text", "placeholder": "command", "optional": true, "percentEncoded": true }
14+
# @raycast.argument1 { "type": "text", "placeholder": "Command (default: toggle)", "optional": true, "percentEncoded": true }
1515
#
1616
# @Documentation:
1717
# @raycast.description Do Not Disturb
1818
# @raycast.author Antonio Dal Sie
1919
# @raycast.authorURL https://github.com/exodusanto
2020

21-
if [[ "$1" != "on" && "$1" != "off" && "$1" != "toggle" ]]; then
22-
echo "Unsupported parameter value: $1 (must be [on/off/toggle])"
21+
cmd=${1:-"toggle"}
22+
23+
if [[ "$cmd" != "on" && "$cmd" != "off" && "$cmd" != "toggle" ]]; then
24+
echo "Unsupported command: $1 (must be [on/off/toggle])"
2325
exit 1
2426
fi
2527

26-
calm-notifications $1
27-
sleep 2
28-
echo "Do Not Disturb $(calm-notifications status)"
28+
calm-notifications $cmd
29+
echo "Do Not Disturb $(calm-notifications status)"

0 commit comments

Comments
 (0)