add notify_sound config option
This commit is contained in:
parent
a79de7ba76
commit
8deeec6f8d
@ -56,6 +56,8 @@ type Config struct {
|
|||||||
RoomCacheSize int `yaml:"room_cache_size"`
|
RoomCacheSize int `yaml:"room_cache_size"`
|
||||||
RoomCacheAge int64 `yaml:"room_cache_age"`
|
RoomCacheAge int64 `yaml:"room_cache_age"`
|
||||||
|
|
||||||
|
NotifySound bool `yaml:"notify_sound"`
|
||||||
|
|
||||||
Dir string `yaml:"-"`
|
Dir string `yaml:"-"`
|
||||||
CacheDir string `yaml:"cache_dir"`
|
CacheDir string `yaml:"cache_dir"`
|
||||||
HistoryPath string `yaml:"history_path"`
|
HistoryPath string `yaml:"history_path"`
|
||||||
@ -83,6 +85,8 @@ func NewConfig(configDir, cacheDir string) *Config {
|
|||||||
|
|
||||||
RoomCacheSize: 32,
|
RoomCacheSize: 32,
|
||||||
RoomCacheAge: 1 * 60,
|
RoomCacheAge: 1 * 60,
|
||||||
|
|
||||||
|
NotifySound: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +431,9 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, shoul
|
|||||||
|
|
||||||
if shouldNotify && !recentlyFocused {
|
if shouldNotify && !recentlyFocused {
|
||||||
// Push rules say notify and the terminal is not focused, send desktop notification.
|
// 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)
|
sendNotification(room, message.NotificationSenderName(), message.NotificationContent(), should.Highlight, shouldPlaySound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user