From ef803f14c11fd15d55fb6dfd2a146f5a11171eb1 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Fri, 3 Jun 2016 11:34:07 +0100 Subject: Clean function for colorschemes --- Xresources/.Xresources/base | 32 ++++++++++++++++ Xresources/.Xresources/base.xresources | 32 ---------------- Xresources/.Xresources/seoul256.dark | 28 ++++++++++++++ Xresources/.Xresources/seoul256.dark.xresources | 27 -------------- Xresources/.Xresources/solarized.dark | 28 ++++++++++++++ Xresources/.Xresources/solarized.light | 28 ++++++++++++++ .../.Xresources/solarized.mine.dark.xresources | 26 ------------- .../.Xresources/solarized.mine.light.xresources | 26 ------------- Xresources/.Xresources/transparent | 5 +++ Xresources/.Xresources/transparent.xresources | 3 -- zsh/.zsh/functions | 43 +++++----------------- 11 files changed, 131 insertions(+), 147 deletions(-) create mode 100644 Xresources/.Xresources/base delete mode 100644 Xresources/.Xresources/base.xresources create mode 100644 Xresources/.Xresources/seoul256.dark delete mode 100644 Xresources/.Xresources/seoul256.dark.xresources create mode 100644 Xresources/.Xresources/solarized.dark create mode 100644 Xresources/.Xresources/solarized.light delete mode 100644 Xresources/.Xresources/solarized.mine.dark.xresources delete mode 100644 Xresources/.Xresources/solarized.mine.light.xresources create mode 100644 Xresources/.Xresources/transparent delete mode 100644 Xresources/.Xresources/transparent.xresources diff --git a/Xresources/.Xresources/base b/Xresources/.Xresources/base new file mode 100644 index 0000000..724c04c --- /dev/null +++ b/Xresources/.Xresources/base @@ -0,0 +1,32 @@ +! URXVT ! + +! General settings +URxvt.loginShell : true +URxvt.termName : rxvt-256color + +! Custom META key +URxvt*modifier: alt + +! Copy-paste configuration +URxvt.clipboard.copycmd: xclip -i -selection clipboard +URxvt.clipboard.pastecmd: xclip -o -selection clipboard + +! Perl extensions configuration +URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select,resize +URxvt.url-select.launcher: /usr/bin/qutebrowser +URxvt.url-select.underline: true + +! Key bindings for extensions +URxvt.keysym.M-Escape: perl:keyboard-select:activate +URxvt.keysym.M-s: perl:keyboard-select:search +URxvt.keysym.M-u: perl:url-select:select_next +URxvt.keysym.M-y: perl:clipboard:copy +URxvt.keysym.M-p: perl:clipboard:paste +URxvt.resize-font.smaller: C-minus +URxvt.resize-font.bigger: C-plus + +! Appearance +/* URxvt*font: xft:DejaVu Sans Mono:size=12 */ +URxvt*font: xft:monaco:size=11 +URxvt*scrollBar: false +URxvt*internalBorder: 0 diff --git a/Xresources/.Xresources/base.xresources b/Xresources/.Xresources/base.xresources deleted file mode 100644 index 724c04c..0000000 --- a/Xresources/.Xresources/base.xresources +++ /dev/null @@ -1,32 +0,0 @@ -! URXVT ! - -! General settings -URxvt.loginShell : true -URxvt.termName : rxvt-256color - -! Custom META key -URxvt*modifier: alt - -! Copy-paste configuration -URxvt.clipboard.copycmd: xclip -i -selection clipboard -URxvt.clipboard.pastecmd: xclip -o -selection clipboard - -! Perl extensions configuration -URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select,resize -URxvt.url-select.launcher: /usr/bin/qutebrowser -URxvt.url-select.underline: true - -! Key bindings for extensions -URxvt.keysym.M-Escape: perl:keyboard-select:activate -URxvt.keysym.M-s: perl:keyboard-select:search -URxvt.keysym.M-u: perl:url-select:select_next -URxvt.keysym.M-y: perl:clipboard:copy -URxvt.keysym.M-p: perl:clipboard:paste -URxvt.resize-font.smaller: C-minus -URxvt.resize-font.bigger: C-plus - -! Appearance -/* URxvt*font: xft:DejaVu Sans Mono:size=12 */ -URxvt*font: xft:monaco:size=11 -URxvt*scrollBar: false -URxvt*internalBorder: 0 diff --git a/Xresources/.Xresources/seoul256.dark b/Xresources/.Xresources/seoul256.dark new file mode 100644 index 0000000..f775e12 --- /dev/null +++ b/Xresources/.Xresources/seoul256.dark @@ -0,0 +1,28 @@ +#include "/home/urbain/.Xresources/base" + +URxvt.borderColor: #3a3a3a + +! Background / Foreground +URxvt*background: #3a3a3a +URxvt*foreground: #d0d0d0 + +! Other colors +URxvt*color0: #4e4e4e +URxvt*color1: #d68787 +URxvt*color2: #5f865f +URxvt*color3: #d8af5f +URxvt*color4: #85add4 +URxvt*color5: #d7afaf +URxvt*color6: #87afaf +URxvt*color7: #d0d0d0 +URxvt*color8: #626262 +URxvt*color9: #d75f87 +URxvt*color10: #87af87 +URxvt*color11: #ffd787 +URxvt*color12: #add4fb +URxvt*color13: #ffafaf +URxvt*color14: #87d7d7 +URxvt*color15: #e4e4e4 +URxvt*cursorColor: #d0d0d0 +URxvt*cursorColor2: #3a3a3a +URxvt*colorBD: #e4e4e4 diff --git a/Xresources/.Xresources/seoul256.dark.xresources b/Xresources/.Xresources/seoul256.dark.xresources deleted file mode 100644 index ad67aa5..0000000 --- a/Xresources/.Xresources/seoul256.dark.xresources +++ /dev/null @@ -1,27 +0,0 @@ -! Border color -URxvt.borderColor: #3a3a3a - -! Background / Foreground -URxvt*background: #3a3a3a -URxvt*foreground: #d0d0d0 - -! Other colors -URxvt*color0: #4e4e4e -URxvt*color1: #d68787 -URxvt*color2: #5f865f -URxvt*color3: #d8af5f -URxvt*color4: #85add4 -URxvt*color5: #d7afaf -URxvt*color6: #87afaf -URxvt*color7: #d0d0d0 -URxvt*color8: #626262 -URxvt*color9: #d75f87 -URxvt*color10: #87af87 -URxvt*color11: #ffd787 -URxvt*color12: #add4fb -URxvt*color13: #ffafaf -URxvt*color14: #87d7d7 -URxvt*color15: #e4e4e4 -URxvt*cursorColor: #d0d0d0 -URxvt*cursorColor2: #3a3a3a -URxvt*colorBD: #e4e4e4 diff --git a/Xresources/.Xresources/solarized.dark b/Xresources/.Xresources/solarized.dark new file mode 100644 index 0000000..9fdfd89 --- /dev/null +++ b/Xresources/.Xresources/solarized.dark @@ -0,0 +1,28 @@ +#include "/home/urbain/.Xresources/base" + +URxvt.borderColor: #002b36 + +*background: #002b36 +*foreground: #839496 +*fadeColor: #002b36 +*cursorColor: #93a1a1 + +*pointerColorBackground: #586e75 +*pointerColorForeground: #93a1a1 + +*color0: #073642 +*color8: #002b36 +*color1: #dc322f +*color9: #cb4b16 +*color2: #859900 +*color10: #586e75 +*color3: #b58900 +*color11: #657b83 +*color4: #268bd2 +*color12: #839496 +*color5: #d33682 +*color13: #6c71c4 +*color6: #2aa198 +*color14: #93a1a1 +*color7: #eee8d5 +*color15: #fdf6e3 diff --git a/Xresources/.Xresources/solarized.light b/Xresources/.Xresources/solarized.light new file mode 100644 index 0000000..d19cf66 --- /dev/null +++ b/Xresources/.Xresources/solarized.light @@ -0,0 +1,28 @@ +#include "/home/urbain/.Xresources/base" + +URxvt.borderColor: #fdf6e3 + +*background: #fdf6e3 +*foreground: #657b83 +*fadeColor: #fdf6e3 +*cursorColor: #586e75 + +*pointerColorBackground: #93a1a1 +*pointerColorForeground: #586e75 + +*color0: #073642 +*color8: #002b36 +*color1: #dc322f +*color9: #cb4b16 +*color2: #859900 +*color10: #586e75 +*color3: #b58900 +*color11: #657b83 +*color4: #268bd2 +*color12: #839496 +*color5: #d33682 +*color13: #6c71c4 +*color6: #2aa198 +*color14: #93a1a1 +*color7: #eee8d5 +*color15: #fdf6e3 diff --git a/Xresources/.Xresources/solarized.mine.dark.xresources b/Xresources/.Xresources/solarized.mine.dark.xresources deleted file mode 100644 index c820c23..0000000 --- a/Xresources/.Xresources/solarized.mine.dark.xresources +++ /dev/null @@ -1,26 +0,0 @@ -URxvt.borderColor: #002b36 - -*background: #002b36 -*foreground: #839496 -*fadeColor: #002b36 -*cursorColor: #93a1a1 - -*pointerColorBackground: #586e75 -*pointerColorForeground: #93a1a1 - -*color0: #073642 -*color8: #002b36 -*color1: #dc322f -*color9: #cb4b16 -*color2: #859900 -*color10: #586e75 -*color3: #b58900 -*color11: #657b83 -*color4: #268bd2 -*color12: #839496 -*color5: #d33682 -*color13: #6c71c4 -*color6: #2aa198 -*color14: #93a1a1 -*color7: #eee8d5 -*color15: #fdf6e3 diff --git a/Xresources/.Xresources/solarized.mine.light.xresources b/Xresources/.Xresources/solarized.mine.light.xresources deleted file mode 100644 index 5d076f4..0000000 --- a/Xresources/.Xresources/solarized.mine.light.xresources +++ /dev/null @@ -1,26 +0,0 @@ -URxvt.borderColor: #fdf6e3 - -*background: #fdf6e3 -*foreground: #657b83 -*fadeColor: #fdf6e3 -*cursorColor: #586e75 - -*pointerColorBackground: #93a1a1 -*pointerColorForeground: #586e75 - -*color0: #073642 -*color8: #002b36 -*color1: #dc322f -*color9: #cb4b16 -*color2: #859900 -*color10: #586e75 -*color3: #b58900 -*color11: #657b83 -*color4: #268bd2 -*color12: #839496 -*color5: #d33682 -*color13: #6c71c4 -*color6: #2aa198 -*color14: #93a1a1 -*color7: #eee8d5 -*color15: #fdf6e3 diff --git a/Xresources/.Xresources/transparent b/Xresources/.Xresources/transparent new file mode 100644 index 0000000..5f72f38 --- /dev/null +++ b/Xresources/.Xresources/transparent @@ -0,0 +1,5 @@ +#include "/home/urbain/.Xresources/base" + +! True transparency +URxvt.transparent: true +URxvt.shading: 10 diff --git a/Xresources/.Xresources/transparent.xresources b/Xresources/.Xresources/transparent.xresources deleted file mode 100644 index 39d696c..0000000 --- a/Xresources/.Xresources/transparent.xresources +++ /dev/null @@ -1,3 +0,0 @@ -! True transparency -URxvt.transparent: true -URxvt.shading: 10 diff --git a/zsh/.zsh/functions b/zsh/.zsh/functions index 5d629c7..5ea454f 100644 --- a/zsh/.zsh/functions +++ b/zsh/.zsh/functions @@ -1,47 +1,30 @@ #!/bin/zsh -if [[ -z ${ZSH_COLORS} ]]; then - ZSH_COLORS=${HOME}/.local/share/zsh/colors.zsh -fi +[[ -z ${ZSH_COLORS} ]] && ZSH_COLORS=${HOME}/.local/share/zsh/colors.zsh +[[ -f ${ZSH_COLORS} ]] && source ${ZSH_COLORS} -if [[ -d ${HOME}/.Xresources ]]; then - colorschemes=$(echo ${HOME}/.Xresources/**/*.xresources | sed "s#${HOME}/.Xresources/##g" | sed 's#base16/base16-##g' | \ - sed 's/[^ ]\+\.256\.[^ ]\+//g' | sed 's/.xresources//g' | sed 's/[ ]\+/ /g' ) -fi +colorschemes=$(echo ${HOME}/.Xresources/* | sed "s#${HOME}/.Xresources/##g") function colo { - # Xresource file - if [[ ! -z $1 ]]; then - XRESOURCE=$1 - else - XRESOURCE=$(echo ${colorschemes} | sed 's/ /\n/g' | sed '/^[ ]*$/d' | fzf) - [[ -z ${XRESOURCE} ]] && return - fi - if [[ -f ${HOME}/.Xresources/${XRESOURCE}.xresources ]]; then - XRESOURCE_FILE=${HOME}/.Xresources/${XRESOURCE}.xresources - elif [[ -f ${HOME}/.Xresources/base16/base16-${XRESOURCE}.256.xresources ]]; then - XRESOURCE_FILE=${HOME}/.Xresources/base16/base16-${XRESOURCE}.256.xresources - else - echo "Invalid colorscheme!" - return - fi + XRESOURCE=$1 + XRESOURCE_FILE=${HOME}/.Xresources/${XRESOURCE} # Change colors for current session /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 \\a - # Ensure border color is the same as background - bg=$(/usr/bin/cpp ${XRESOURCE_FILE} | grep "background" | sed 's/[^ ]\+[ ]\+\([^ ]\+\)$/\1/') - echo "\x1b]708;${bg}" | tr \\n \\a + # Change color for future sessions + xrdb ${XRESOURCE_FILE} # Change default environment variable for future sessions mkdir -p $(dirname ${ZSH_COLORS}) - COLORSCHEME=$(echo $(basename ${XRESOURCE_FILE}) | sed 's/\([^.]\+\)\..\+$/\1/g') - BACKGROUND=$(echo ${XRESOURCE_FILE} | sed 's/^.\+\(dark\|light\).\+$/\1/') + COLORSCHEME=$(echo ${XRESOURCE} | sed 's/\([^.]\+\)\..\+$/\1/g') + BACKGROUND=$(echo ${XRESOURCE} | sed 's/^.\+\(dark\|light\)/\1/') echo "export COLORSCHEME=${COLORSCHEME}" > ${ZSH_COLORS} echo "export BACKGROUND=${BACKGROUND}" >> ${ZSH_COLORS} @@ -49,11 +32,5 @@ function colo { source ${ZSH_COLORS} } -# Source colors -if [[ -f ${ZSH_COLORS} ]]; then - source ${ZSH_COLORS} - colo ${XRESOURCE} -fi - # Completion for colorschemes (-M -> Case insensitive) compctl -k "(${colorschemes})" -M 'm:{a-z}={A-Z}' colo -- cgit v1.2.3