Skip to content

Commit 1f542e9

Browse files
sumanthvraoneiljp
authored andcommitted
README/helper: Support notification sound for OSX.
The `osascript` command takes in the notification sound as an extra parameter and without it doesn't have a default sound. We set an env variable here to tell zt to play a sound when it receives a notification. README has been updated to describe the changes needed to set the env variable.
1 parent 2e6b3d1 commit 1f542e9

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ set-executionpolicy remotesigned
9595
Install-Module -Name BurntToast
9696
```
9797

98+
#### OSX
99+
100+
No additional package is required to enable notifications in OS X. However to have a notification sound, set the following variable (based on your type of shell). The sound value (here Ping) can be any one of the `.aiff` files found at `/System/Library/Sounds` or `~/Library/Sounds`.
101+
102+
*Bash*
103+
```
104+
echo 'export ZT_NOTIFICATION_SOUND=Ping' >> ~/.bash_profile
105+
source ~/.bash_profile
106+
```
107+
*ZSH*
108+
```
109+
echo 'export ZT_NOTIFICATION_SOUND=Ping' >> ~/.zshenv
110+
source ~/.zshenv
111+
```
112+
98113
## Hot Keys
99114
### General
100115
| Command | Key Combination |

zulipterminal/helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ def notify(title: str, html_text: str) -> None:
528528
elif MACOS: # NOTE Tested and should work!
529529
command_list = shlex.split(
530530
"osascript -e "
531-
"'display notification \"\'{}\'\" with title \"\'{}\'\"'"
531+
"'display notification \"\'{}\'\" with title \"\'{}\'\" "
532+
" sound name \"ZT_NOTIFICATION_SOUND\"'"
532533
.format(quoted_text, quoted_title)
533534
)
534535
expected_length = 3

0 commit comments

Comments
 (0)