---
app.go | 10 ++++---
config.go | 71 ++++++++++++++++++++++++++++--------------------
doc/senpai.5.scd | 6 ++++
3 files changed, 53 insertions(+), 34 deletions(-)
diff --git a/app.go b/app.go
index 509a518..b4a5fa4 100644
--- a/app.go
+++ b/app.go
@@ -1131,10 +1131,12 @@ func (app *App) notifyHighlight(buffer, nick, content string) {
if app.cfg.OnHighlightBeep {
app.win.Beep()
}
- if buffer != nick {
- app.win.Notify(fmt.Sprintf("%s — %s", buffer, nick), content)
- } else {
- app.win.Notify(nick, content)
+ if app.cfg.OnHighlightNotify {
+ if buffer != nick {
+ app.win.Notify(fmt.Sprintf("%s — %s", buffer, nick), content)
+ } else {
+ app.win.Notify(nick, content)
+ }
}
if app.cfg.Transient {
diff --git a/config.go b/config.go
index d9bfe33..ec35878 100644
--- a/config.go
+++ b/config.go
@@ -60,16 +60,17 @@ type Config struct {
Typings bool
Mouse bool
- Highlights []string
- OnHighlightPath string
- OnHighlightBeep bool
- NickColWidth int
- ChanColWidth int
- ChanColEnabled bool
- MemberColWidth int
- MemberColEnabled bool
- TextMaxWidth int
- StatusEnabled bool
+ Highlights []string
+ OnHighlightPath string
+ OnHighlightBeep bool
+ OnHighlightNotify bool
+ NickColWidth int
+ ChanColWidth int
+ ChanColEnabled bool
+ MemberColWidth int
+ MemberColEnabled bool
+ TextMaxWidth int
+ StatusEnabled bool
Colors ui.ConfigColors
@@ -87,26 +88,27 @@ func DefaultHighlightPath() (string, error) {
func Defaults() Config {
return Config{
- Addr: "",
- Nick: "",
- Real: "",
- User: "",
- Password: nil,
- TLS: true,
- TLSSkipVerify: false,
- Channels: nil,
- Typings: true,
- Mouse: true,
- Highlights: nil,
- OnHighlightPath: "",
- OnHighlightBeep: false,
- NickColWidth: 14,
- ChanColWidth: 16,
- ChanColEnabled: true,
- MemberColWidth: 16,
- MemberColEnabled: true,
- TextMaxWidth: 0,
- StatusEnabled: true,
+ Addr: "",
+ Nick: "",
+ Real: "",
+ User: "",
+ Password: nil,
+ TLS: true,
+ TLSSkipVerify: false,
+ Channels: nil,
+ Typings: true,
+ Mouse: true,
+ Highlights: nil,
+ OnHighlightPath: "",
+ OnHighlightBeep: false,
+ OnHighlightNotify: true,
+ NickColWidth: 14,
+ ChanColWidth: 16,
+ ChanColEnabled: true,
+ MemberColWidth: 16,
+ MemberColEnabled: true,
+ TextMaxWidth: 0,
+ StatusEnabled: true,
Colors: ui.ConfigColors{
Status: tcell.ColorGray,
Prompt: tcell.ColorDefault,
@@ -239,6 +241,15 @@ func unmarshal(filename string, cfg *Config) (err error) {
if cfg.OnHighlightBeep, err = strconv.ParseBool(onHighlightBeep); err != nil {
return err
}
+ case "on-highlight-notify":
+ var onHighlightNotify string
+ if err := d.ParseParams(&onHighlightNotify); err != nil {
+ return err
+ }
+
+ if cfg.OnHighlightNotify, err = strconv.ParseBool(onHighlightNotify); err != nil {
+ return err
+ }
case "pane-widths":
for _, child := range d.Children {
switch child.Name {
diff --git a/doc/senpai.5.scd b/doc/senpai.5.scd
index 198157c..a81f565 100644
--- a/doc/senpai.5.scd
+++ b/doc/senpai.5.scd
@@ -68,6 +68,12 @@ Some settings are required, the others are optional.
Enable sending the bell character (BEL) when you are highlighted.
Defaults to disabled.
+*on-highlight-notify*
+ Enable sending desktop notifications when you are highlighted.
+ This is supported on some modern terminals, like foot or urxvt,
+ via "OSC 777;notify".
+ Defaults to enabled.
+
*on-highlight-path*
Alternative path to a shell script to be executed when you are highlighted.
By default, senpai looks for a highlight shell script at
base-commit: 21fcd224499af076398ab89e2602de58405c3acc
--
2.42.0