Fix tmux-dcs-passthrough & notify utilities
These two have been sitting in a broken state for quite a while but I findally RTFM and realised that the escape characters in the escape sequence need to be doubled up in order for tmux to properly pass through the escape sequence.
This commit is contained in:
parent
a6d97c1eac
commit
42260925a0
@ -26,16 +26,21 @@ fi
|
||||
|
||||
# Passthrough an escape sequences tmux doesn't know about.
|
||||
tmux-dcs-passthrough() {
|
||||
local escape_sequence=$1
|
||||
if [ -n "$TMUX" ]; then
|
||||
printf "\x1bPtmux;\x1b$1\x1b\\"
|
||||
# Replace single \x1b or \033 with two, this is required for tmux to
|
||||
# properly pass-through the escape sequence.
|
||||
escape_sequence=${escape_sequence//\\x1b/\\x1b\\x1b}
|
||||
escape_sequence=${escape_sequence//\\033/\\x1b\\x1b}
|
||||
printf '\x1bPtmux;\x1b'"$escape_sequence"'\x1b\\'
|
||||
else
|
||||
printf "$1"
|
||||
printf "$escape_sequence"
|
||||
fi
|
||||
}
|
||||
|
||||
# OSC 9 - Post a notification - supported by iTerm2, maybe others?
|
||||
# OSC 9 - Post a notification - supported by iTerm2, kitty, maybe others?
|
||||
notify() {
|
||||
tmux-dcs-passthrough "\x1b]9;$*\x7"
|
||||
tmux-dcs-passthrough '\x1b]9;'"$*"'\x7'
|
||||
}
|
||||
|
||||
# Detect the type and extract an archive file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user