From 750e9a5d58c2719a87f931eb5bcc505d382cb6c7 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Thu, 21 Apr 2016 14:21:38 +0100 Subject: Add tomorrow theme and improve script --- zsh/.zsh/functions | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'zsh') diff --git a/zsh/.zsh/functions b/zsh/.zsh/functions index 7c2b49a..07fca73 100644 --- a/zsh/.zsh/functions +++ b/zsh/.zsh/functions @@ -2,15 +2,26 @@ function colo { + # Change environment variable + export COLORSCHEME=$1 + export BACKGROUND=$2 + + if [[ -z ${BACKGROUND} ]]; then + XRESOURCE=~/.Xresources/${COLORSCHEME} + else + XRESOURCE=~/.Xresources/${COLORSCHEME}-${BACKGROUND} + fi + # Change colors for current session - $HOME/bin/recolor < ~/.Xresources/$1 + $HOME/bin/recolor < ${XRESOURCE} # Load Xresources file for future sessions - xrdb -I$HOME ~/.Xresources/$1 - - # Change environment variable - export COLORSCHEME=$1 + xrdb -I$HOME ${XRESOURCE} # Change default environment variable for future sessions - sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/.zsh/tmp + sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=${COLORSCHEME}/g" ~/.zsh/tmp + sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export BACKGROUND=${BACKGROUND}/g" ~/.zsh/tmp } + +# Completion for colorschemes +compctl -k "($(ls ${HOME}/.Xresources))" colo -- cgit v1.2.3