commit 6be7183

Alexey Yerin  ·  2021-05-27 13:53:59 +0000 UTC
parent 70d519a
doc/senpai.5: mention the issue with \ disappearing

Fixes #65
1 files changed,  +18, -1
+18, -1
 1@@ -53,6 +53,20 @@ Some settings are required, the others are optional.
 2 |  SENDER
 3 :  nickname of the sender
 4 
 5+	Note: when passing those to *notify-send*(1), some notification daemons use
 6+	*\* for escape sequences in the body, which causes *\* to disappear from the
 7+	message or triggers unintended side-effects (like newlines).
 8+
 9+	To get around this, you can double the backslash with the following snippet:
10+
11+```
12+on-highlight: |
13+    escape() {
14+        printf "%s" "$1" | sed 's#\\#\\\\#g'
15+    }
16+    notify-send "[$BUFFER] $SENDER" "$(escape "$MESSAGE")"
17+```
18+
19 *nick-column-width*
20 	The number of cell that the column for nicknames occupies in the timeline.
21 	By default, 16.
22@@ -117,9 +131,12 @@ highlights:
23 	- guest
24 	- senpai
25 on-highlight: |
26+    escape() {
27+        printf "%s" "$1" | sed 's#\\#\\\\#g'
28+    }
29     FOCUS=$(swaymsg -t get_tree | jq '..|objects|select(.focused==true)|.name' | grep senpai | wc -l)
30     if [ "$HERE" -eq 0 ] || [ $FOCUS -eq 0 ]; then
31-        notify-send "[$BUFFER] $SENDER" "$MESSAGE"
32+        notify-send "[$BUFFER] $SENDER" "$(escape "$MESSAGE")"
33     fi
34 nick-column-width: 12
35 ```