diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index d40dc2a..f9b4ef6 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -188,60 +188,76 @@ alias myip="curl https://ifconfig.co" alias light='bashrc_update_colors light' alias dark='bashrc_update_colors dark' + +bashrc_send_osc() { + local OSC="\E]" ST="\E\\" + if [ -n "$TMUX" ]; then OSC="\EPtmux;\E\E]"; fi + echo -ne "$OSC$1$ST" +} + bashrc_update_colors() { export BACKGROUND="$1" - if [ -n "$TMUX" ] && [ -f "$HOME/.tmux.conf" ]; then - tmux set-environment -g BACKGROUND "$BACKGROUND" - tmux source-file "$HOME/.tmux.conf" - fi - - # Terminal OSC (Operating System Commmand) definition - local osc='\033]%s\033\\' - if [ -n "$TMUX" ]; then osc='\033Ptmux;\033\033]%s\007\033\\' - elif [ ${TERM%%[-.]*} = screen ]; then osc='\033P\033]%s\007\033\\' - fi - - # Solarize the terminal: 4;n;#rrggbb - local n rgb comment - while read n rgb comment; do printf "$osc" "4;$n;#$rgb"; done <