commit e8ed8e7
Kirill Chibisov
·
2022-06-29 15:12:32 +0000 UTC
parent f13aa04
Add a config option to beep on highlight This will allow to bring user attention when you are getting highlighted.
4 files changed,
+24,
-1
M
app.go
+4,
-0
1@@ -978,6 +978,10 @@ func (app *App) isHighlight(s *irc.Session, content string) bool {
2 // notifyHighlight executes the script at "on-highlight-path" according to the given
3 // message context.
4 func (app *App) notifyHighlight(buffer, nick, content string) {
5+ if app.cfg.OnHighlightBeep {
6+ app.win.Beep()
7+ }
8+
9 path := app.cfg.OnHighlightPath
10 if path == "" {
11 defaultHighlightPath, err := DefaultHighlightPath()
+11,
-0
1@@ -63,6 +63,7 @@ type Config struct {
2
3 Highlights []string
4 OnHighlightPath string
5+ OnHighlightBeep bool
6 NickColWidth int
7 ChanColWidth int
8 ChanColEnabled bool
9@@ -96,6 +97,7 @@ func Defaults() (cfg Config, err error) {
10 Mouse: true,
11 Highlights: nil,
12 OnHighlightPath: "",
13+ OnHighlightBeep: false,
14 NickColWidth: 14,
15 ChanColWidth: 16,
16 ChanColEnabled: true,
17@@ -197,6 +199,15 @@ func unmarshal(filename string, cfg *Config) (err error) {
18 if err := d.ParseParams(&cfg.OnHighlightPath); err != nil {
19 return err
20 }
21+ case "on-highlight-beep":
22+ var onHighlightBeep string
23+ if err := d.ParseParams(&onHighlightBeep); err != nil {
24+ return err
25+ }
26+
27+ if cfg.OnHighlightBeep, err = strconv.ParseBool(onHighlightBeep); err != nil {
28+ return err
29+ }
30 case "pane-widths":
31 for _, child := range d.Children {
32 switch child.Name {
+5,
-1
1@@ -44,7 +44,7 @@ Some settings are required, the others are optional.
2 used for login.
3
4 *channel*
5- A spaced separated list of channel names that senpai will automatically join
6+ A space separated list of channel names that senpai will automatically join
7 at startup and server reconnect. This directive can be specified multiple
8 times.
9
10@@ -55,6 +55,10 @@ Some settings are required, the others are optional.
11
12 By default, senpai will use your current nickname.
13
14+*on-highlight-beep*
15+ Enable sending the bell character (BEL) when you are highlighted.
16+ Defaults to disabled.
17+
18 *on-highlight-path*
19 Alternative path to a shell script to be executed when you are highlighted.
20 By default, senpai looks for a highlight shell script at
M
ui/ui.go
+4,
-0
1@@ -421,6 +421,10 @@ func (ui *UI) Size() (int, int) {
2 return ui.screen.Size()
3 }
4
5+func (ui *UI) Beep() {
6+ ui.screen.Beep()
7+}
8+
9 func (ui *UI) Draw(members []irc.Member) {
10 w, h := ui.screen.Size()
11