From bf681b02022b8bee8c122d0d3de2f1d4a3d0a174 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Tue, 9 May 2017 12:06:42 +0100 Subject: Make colo function work in tmux --- zsh/.zsh/functions | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'zsh') diff --git a/zsh/.zsh/functions b/zsh/.zsh/functions index ae85104..0735fa2 100644 --- a/zsh/.zsh/functions +++ b/zsh/.zsh/functions @@ -11,13 +11,19 @@ function colo { XRESOURCE_FILE=${HOME}/.Xresources/${XRESOURCE} # Change colors for current session + if [[ ! -z "$TMUX" ]]; then + printf '\x1bPtmux;' + esc='\x1b\x1b' + else + esc='\x1b' + fi + /usr/bin/cpp ${XRESOURCE_FILE} | tr -d ' \t' | sed -n \ - -e 's/.*background:/\x1b]11;/p' \ - -e 's/.*foreground:/\x1b]10;/p' \ - -e 's/.*borderColor:/\x1b]708;/p' \ - -e 's/.*color\([0-9][^:]*\):/\x1b]4;\1;/p' | tr \\n "\007" + -e "s/.*background:/${esc}]11;/p" \ + -e "s/.*foreground:/${esc}]10;/p" \ + -e "s/.*borderColor:/${esc}]708;/p" \ + -e "s/.*color\\([0-9][^:]*\\):/${esc}]4;\\1;/p" | tr \\n \\a - [ ! -z "$TMUX" ] && printf '\033Ptmux;\033\033]11;white\007\033' # Change color for future sessions xrdb ${XRESOURCE_FILE} -- cgit v1.2.3