diff options
author | evan <evan@evanw.org> | 2020-03-01 04:49:32 -0600 |
---|---|---|
committer | evan <evan@evanw.org> | 2020-03-01 05:05:37 -0600 |
commit | 8deeec6f8d52d1d5cbaca0895fc275b175e3aeee (patch) | |
tree | 4d827717d6dd5f1d1d1915c4fabd633adc4858f4 | |
parent | a79de7ba76757931559af9a6639255a03eddbf18 (diff) |
add notify_sound config option
-rw-r--r-- | config/config.go | 4 | ||||
-rw-r--r-- | ui/view-main.go | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/config/config.go b/config/config.go index d2d8ff7..c223ee3 100644 --- a/config/config.go +++ b/config/config.go @@ -56,6 +56,8 @@ type Config struct { RoomCacheSize int `yaml:"room_cache_size"` RoomCacheAge int64 `yaml:"room_cache_age"` + NotifySound bool `yaml:"notify_sound"` + Dir string `yaml:"-"` CacheDir string `yaml:"cache_dir"` HistoryPath string `yaml:"history_path"` @@ -83,6 +85,8 @@ func NewConfig(configDir, cacheDir string) *Config { RoomCacheSize: 32, RoomCacheAge: 1 * 60, + + NotifySound: true, } } diff --git a/ui/view-main.go b/ui/view-main.go index 30fa982..172e29f 100644 --- a/ui/view-main.go +++ b/ui/view-main.go @@ -431,7 +431,9 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, shoul if shouldNotify && !recentlyFocused { // Push rules say notify and the terminal is not focused, send desktop notification. - shouldPlaySound := should.PlaySound && should.SoundName == "default" + shouldPlaySound := should.PlaySound && + should.SoundName == "default" && + view.config.NotifySound sendNotification(room, message.NotificationSenderName(), message.NotificationContent(), should.Highlight, shouldPlaySound) } |