commit d2a3caf33a030652e7e113f8fd764eb351e94a3b parent 7a357efb467d5d75baf7cc7c37e68f5cb328d944 Author: Byron Torres <b@torresjrjr.com> Date: Wed, 18 Aug 2021 01:59:09 +0100 Fix config(), improve graphic() and formatters() Diffstat:
M | fetch | | | 52 | ++++++++++++++++++++++++++-------------------------- |
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/fetch b/fetch @@ -18,16 +18,13 @@ main() { ## Graphic graphic() { - #b="${c3}: " # status border - printf "\ -${c2} ~ ${b} -${c2} .-. ${b} -${c2} /\`v\`\\ ${b} -${c2} (/ \\) ${b} -${c2}=====\"=\"===< ${b} -${c2} |_| ${b} -${c2} ${b} -${c0}" + env printf "$c6%s\n" \ + ' ~ ' \ + ' .-. ' \ + ' /`v`\ ' \ + ' (/ \) ' \ + '====="="===< ' \ + ' |_| ' } @@ -79,33 +76,36 @@ _palette() { ## Config config() { - graphic="${XDG_CONFIG_HOME:-$HOME/.config}/fetch/graphic.sh" - [ -f "${graphic}" ] && . "${graphic}" + config="${XDG_CONFIG_HOME:-$HOME/.config}/fetch/config.sh" + [ -f "$config" ] && . "$config" + + graphic_y=$(graphic | wc -l) # height + graphic_x=$(graphic | wc -L) # width } ## Formatters formatters() { - c0='\x1b[0m' - - c1='\x1b[1;31m'; c2='\x1b[1;32m' - c3='\x1b[1;33m'; c4='\x1b[1;34m' - c5='\x1b[1;35m'; c6='\x1b[1;36m' - c7='\x1b[1;37m'; c8='\x1b[1;38m' - - ul='\x1b[4m' - rv='\x1b[7m' + c0='\x1b[0m' # normal + + c1='\x1b[1;31m' # bold red + c2='\x1b[1;32m' # bold green + c3='\x1b[1;33m' # bold yellow + c4='\x1b[1;34m' # bold blue + c5='\x1b[1;35m' # bold magenta + c6='\x1b[1;36m' # bold cyan + c7='\x1b[1;37m' # bold white + + ul='\x1b[4m' # underline + rv='\x1b[7m' # reverse video } ## Cursor util -graphic_y=$(graphic | wc -l) # height -graphic_x=$(graphic | wc -L) # width - -reposition() { printf '\e[%sA\r' "${graphic_y}" ;} -padding() { printf '\e[%sC' "${graphic_x}" ;} +reposition() { printf '\e[%sA\r' "$graphic_y" ;} +padding() { printf '\e[%sC' "$graphic_x" ;} ## Run