diff --git a/utilities/utilities.plugin.zsh b/utilities/utilities.plugin.zsh index 3a13aaf..357b65d 100644 --- a/utilities/utilities.plugin.zsh +++ b/utilities/utilities.plugin.zsh @@ -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.