senpai(5) | File Formats Manual | senpai(5) |
NAME
senpai - Configuration file format and settings
DESCRIPTION
A senpai configuration file is a scfg file. See https://git.sr.ht/~emersion/scfg.
Some settings are required, the others are optional.
SETTINGS
address (required)
An optional scheme can be specified (scheme://host[:port]):
nickname (required)
realname
username
password
password-cmd command [arguments...]
channel
highlight
By default, senpai will use your current nickname.
on-highlight-beep
on-highlight-path
If unset, $XDG_CONFIG_HOME defaults to ~/.config/.
Before the highlight script is executed, the following environment variables are populated:
Shell scripts MUST ENSURE VARIABLES appear QUOTED in the script file, OR YOU WILL BE OPEN TO SHELL INJECTION ATTACKS. Shell scripts must also ensure characters like '*' and '?' are not expanded.
Environment variable | Description |
BUFFER | buffer where the message appeared |
HERE | equals 1 if BUFFER is the current buffer, 0 otherwise |
MESSAGE | content of the message |
SENDER | nickname of the sender |
To get around this, you can double the backslash with the following snippet:
#!/bin/sh escape() { printf "%s" "$1" | sed 's#\#\\#g' } notify-send "[$BUFFER] $SENDER" "$(escape "$MESSAGE")"
pane-widths { ... }
Pane widths are set as sub-directives of the main pane-widths directive:
pane-widths { nicknames 16 }
nicknames
channels
members
text
tls
typings
mouse
colors { ... }
Colors can be set either by name ("red"), by number (from 0 to 255, for the default 256 terminal colors; -1 meaning default), or by RGB hex true color (#rrggbb).
Colors are set as sub-directives of the main colors directive:
colors { prompt green }
Sub-directive | Description |
prompt <color> | color for ">"-prompt that appears in command mode |
unread <color> | foreground color for unread buffer names in buffer lists |
status [...] | foreground color for status event lines (e.g. join, part, nick changes) in buffers, see table below |
nicks [...] | color scheme for user nicks, see table below |
status sub-directive | Description |
status <color> | show status events with the specified color |
status disabled | hide status events |
nicks sub-directive | Description |
nicks base | show nicks with 16 different colors (default) |
nicks extended | show nicks with 256 different colors |
nicks fixed [<others> [self]] | show nicks with a fixed color, optionally specifying the colors for other nicks, and self |
debug
-transient
EXAMPLES
A minimal configuration file to connect to Libera.Chat as "Guest123456":
address irc.libera.chat nickname Guest123456
A more advanced configuration file that enables SASL authentication, fetches the password from an external program instead of storing in plaintext, sends notifications on highlight and decreases the width of the nick column to 12 (note: swaymsg is specific to sway, a wayland compositor. Use whatever you need to know if the terminal emulator that runs senpai has focus):
address irc.libera.chat nickname Guest123456 username senpai realname "Guest von Lenon" password-cmd gopass show irc/guest # use your favorite CLI password solution here channel "#rahxephon" highlight guest senpai highlight lenon # don't know why you'd split it into multiple lines, but you can if you want pane-widths { nicknames 12 }
And the highlight file (~/.config/senpai/highlight):
#!/bin/sh escape() { printf "%s" "$1" | sed 's#\#\\#g' } FOCUS=$(swaymsg -t get_tree | jq '..|objects|select(.focused==true)|.name' | grep senpai | wc -l) if [ "$HERE" -eq 0 ] || [ $FOCUS -eq 0 ]; then notify-send "[$BUFFER] $SENDER" "$(escape "$MESSAGE")" fi
SEE ALSO
2023-11-27 |