Merge pull request #437 from dylanaraps/ascii2
Ascii: Cleanup ascii functions
This commit is contained in:
commit
9612632048
6 changed files with 198 additions and 229 deletions
|
@ -1,19 +1,19 @@
|
||||||
${c1} `.-/::/-``
|
${c2} `.-/::/-``
|
||||||
.-/osssssssso/.
|
.-/osssssssso/.
|
||||||
:osyysssssssyyys+-
|
:osyysssssssyyys+-
|
||||||
`.+yyyysssssssssyyyyy+.
|
`.+yyyysssssssssyyyyy+.
|
||||||
`/syyyyyssssssssssyyyyys-`
|
`/syyyyyssssssssssyyyyys-`
|
||||||
`/yhyyyyysss${c2}++${c1}ssosyyyyhhy/`
|
`/yhyyyyysss${c1}++${c2}ssosyyyyhhy/`
|
||||||
.ohhhyyyys${c2}o++/+o${c1}so${c2}+${c1}syy${c2}+${c1}shhhho.
|
.ohhhyyyys${c1}o++/+o${c2}so${c1}+${c2}syy${c1}+${c2}shhhho.
|
||||||
.shhhhys${c2}oo++//+${c1}sss${c2}+++${c1}yyy${c2}+s${c1}hhhhs.
|
.shhhhys${c1}oo++//+${c2}sss${c1}+++${c2}yyy${c1}+s${c2}hhhhs.
|
||||||
-yhhhhs${c2}+++++++o${c1}ssso${c2}+++${c1}yyy${c2}s+o${c1}hhddy:
|
-yhhhhs${c1}+++++++o${c2}ssso${c1}+++${c2}yyy${c1}s+o${c2}hhddy:
|
||||||
-yddhhy${c2}o+++++o${c1}syyss${c2}++++${c1}yyy${c2}yooy${c1}hdddy-
|
-yddhhy${c1}o+++++o${c2}syyss${c1}++++${c2}yyy${c1}yooy${c2}hdddy-
|
||||||
.yddddhs${c2}o++o${c1}syyyyys${c2}+++++${c1}yyhh${c2}sos${c1}hddddy`
|
.yddddhs${c1}o++o${c2}syyyyys${c1}+++++${c2}yyhh${c1}sos${c2}hddddy`
|
||||||
`odddddhyosyhyyyyyy${c2}++++++${c1}yhhhyosddddddo
|
`odddddhyosyhyyyyyy${c1}++++++${c2}yhhhyosddddddo
|
||||||
.dmdddddhhhhhhhyyyo${c2}+++++${c1}shhhhhohddddmmh.
|
.dmdddddhhhhhhhyyyo${c1}+++++${c2}shhhhhohddddmmh.
|
||||||
ddmmdddddhhhhhhhso${c2}++++++${c1}yhhhhhhdddddmmdy
|
ddmmdddddhhhhhhhso${c1}++++++${c2}yhhhhhhdddddmmdy
|
||||||
dmmmdddddddhhhyso${c2}++++++${c1}shhhhhddddddmmmmh
|
dmmmdddddddhhhyso${c1}++++++${c2}shhhhhddddddmmmmh
|
||||||
-dmmmdddddddhhys${c2}o++++o${c1}shhhhdddddddmmmmd-
|
-dmmmdddddddhhys${c1}o++++o${c2}shhhhdddddddmmmmd-
|
||||||
.smmmmddddddddhhhhhhhhhdddddddddmmmms.
|
.smmmmddddddddhhhhhhhhhdddddddddmmmms.
|
||||||
`+ydmmmdddddddddddddddddddmmmmdy/.
|
`+ydmmmdddddddddddddddddddmmmmdy/.
|
||||||
`.:+ooyyddddddddddddyyso+:.`
|
`.:+ooyyddddddddddddyyso+:.`
|
||||||
|
|
|
@ -7,9 +7,9 @@ ${c1} -`
|
||||||
`/:-:++oooo+:
|
`/:-:++oooo+:
|
||||||
`/++++/+++++++:
|
`/++++/+++++++:
|
||||||
`/++++++++++++++:
|
`/++++++++++++++:
|
||||||
`/+++o${c2}oooooooo${c1}oooo/`
|
`/+++ooooooooooooo/`
|
||||||
./${c2}ooosssso++osssssso${c1}+`
|
./ooosssso++osssssso+`
|
||||||
${c2} .oossssso-````/ossssss+`
|
.oossssso-````/ossssss+`
|
||||||
-osssssso. :ssssssso.
|
-osssssso. :ssssssso.
|
||||||
:osssssss/ osssso+++.
|
:osssssss/ osssso+++.
|
||||||
/ossssssss/ +ssssooo/-
|
/ossssssss/ +ssssooo/-
|
||||||
|
|
|
@ -7,8 +7,8 @@ M- ,=;;;#:, ,:#;;:=, ,@
|
||||||
:# :#.=/++++/=.$= #=
|
:# :#.=/++++/=.$= #=
|
||||||
,#; #/:+/;,,/++:+/ ;+.
|
,#; #/:+/;,,/++:+/ ;+.
|
||||||
,+/. ,;@+, ,#H;, ,/+,
|
,+/. ,;@+, ,#H;, ,/+,
|
||||||
;+;;/= @. ${c2}.H${c3}#${c2}#X ${c1}-X :///+;
|
;+;;/= @. ${c3}.H${c2}#${c3}#X ${c1}-X :///+;
|
||||||
;+=;;;.@, ${c3}.X${c2}M${c3}@$. ${c1}=X.//;=#/.
|
;+=;;;.@, ${c2}.X${c3}M${c2}@$. ${c1}=X.//;=#/.
|
||||||
,;: :@#= =$H: .+#-
|
,;: :@#= =$H: .+#-
|
||||||
,#= #;-///==///-// =#,
|
,#= #;-///==///-// =#,
|
||||||
;+ :#-;;;:;;;;-X- +:
|
;+ :#-;;;:;;;;-X- +:
|
||||||
|
|
|
@ -250,24 +250,24 @@ block_height=1
|
||||||
|
|
||||||
# Progress bar character
|
# Progress bar character
|
||||||
# --progress_char elapsed_char total_char
|
# --progress_char elapsed_char total_char
|
||||||
progress_char_elapsed="-"
|
bar_char_elapsed="-"
|
||||||
progress_char_total="="
|
bar_char_total="="
|
||||||
|
|
||||||
# Progress border
|
# Progress border
|
||||||
# --progress_border on, off
|
# --progress_border on, off
|
||||||
progress_border="on"
|
bar_border="on"
|
||||||
|
|
||||||
# Progress bar length in spaces
|
# Progress bar length in spaces
|
||||||
# Number of chars long to make the progress bars.
|
# Number of chars long to make the progress bars.
|
||||||
# --progress_length num
|
# --progress_length num
|
||||||
progress_length="15"
|
bar_length="15"
|
||||||
|
|
||||||
# Progress bar colors
|
# Progress bar colors
|
||||||
# When set to distro, uses your distro's logo colors
|
# When set to distro, uses your distro's logo colors
|
||||||
# Takes: num, "distro"
|
# Takes: num, "distro"
|
||||||
# --progress_colors col col
|
# --progress_colors col col
|
||||||
progress_color_elapsed="distro"
|
bar_color_elapsed="distro"
|
||||||
progress_color_total="distro"
|
bar_color_total="distro"
|
||||||
|
|
||||||
# Customize how the info is displayed.
|
# Customize how the info is displayed.
|
||||||
# bar: Only the progress bar is displayed.
|
# bar: Only the progress bar is displayed.
|
||||||
|
|
357
neofetch
357
neofetch
|
@ -19,6 +19,9 @@ export LANG=C
|
||||||
# Set no case match.
|
# Set no case match.
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch
|
||||||
|
|
||||||
|
# Reset colors/bold
|
||||||
|
reset="\033[0m"
|
||||||
|
|
||||||
# DETECT INFORMATION
|
# DETECT INFORMATION
|
||||||
|
|
||||||
get_os() {
|
get_os() {
|
||||||
|
@ -1063,7 +1066,7 @@ get_memory() {
|
||||||
esac
|
esac
|
||||||
memory="${memused}MB / ${memtotal}MB"
|
memory="${memused}MB / ${memtotal}MB"
|
||||||
|
|
||||||
# Progress bars
|
# Bars
|
||||||
case "$memory_display" in
|
case "$memory_display" in
|
||||||
"bar") memory="$(bar "${memused}" "${memtotal}")" ;;
|
"bar") memory="$(bar "${memused}" "${memtotal}")" ;;
|
||||||
"infobar") memory="${memory} $(bar "${memused}" "${memtotal}")" ;;
|
"infobar") memory="${memory} $(bar "${memused}" "${memtotal}")" ;;
|
||||||
|
@ -1849,18 +1852,6 @@ get_image_backend() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
get_image_program() {
|
|
||||||
if [[ -n "$ITERM_PROFILE" ]]; then
|
|
||||||
image_program="iterm2"
|
|
||||||
|
|
||||||
elif [[ "$(tycat 2>/dev/null)" ]]; then
|
|
||||||
image_program="tycat"
|
|
||||||
|
|
||||||
else
|
|
||||||
image_program="w3m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_ascii() {
|
get_ascii() {
|
||||||
if [[ ! -f "$ascii" || "$ascii" == "distro" ]]; then
|
if [[ ! -f "$ascii" || "$ascii" == "distro" ]]; then
|
||||||
# Error message
|
# Error message
|
||||||
|
@ -1932,6 +1923,18 @@ get_ascii() {
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_image_program() {
|
||||||
|
if [[ -n "$ITERM_PROFILE" ]]; then
|
||||||
|
image_program="iterm2"
|
||||||
|
|
||||||
|
elif [[ "$(tycat 2>/dev/null)" ]]; then
|
||||||
|
image_program="tycat"
|
||||||
|
|
||||||
|
else
|
||||||
|
image_program="w3m"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
get_w3m_img_path() {
|
get_w3m_img_path() {
|
||||||
if [[ -x "$w3m_img_path" ]]; then
|
if [[ -x "$w3m_img_path" ]]; then
|
||||||
return
|
return
|
||||||
|
@ -2300,13 +2303,13 @@ info() {
|
||||||
err "Info: Couldn't detect $subtitle." && return
|
err "Info: Couldn't detect $subtitle." && return
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
title)
|
"title")
|
||||||
string="${title_color}${bold}${output}"
|
string="${title_color}${bold}${output}"
|
||||||
string="${string/@/${at_color}@${title_color}${bold}}"
|
string="${string/@/${at_color}@${title_color}${bold}}"
|
||||||
length="${#output}"
|
length="${#output}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
underline) string="${underline_color}${output}" ;;
|
"underline") string="${underline_color}${output}" ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
string="${subtitle_color}${bold}${subtitle}${reset}"
|
string="${subtitle_color}${bold}${subtitle}${reset}"
|
||||||
|
@ -2367,196 +2370,188 @@ get_underline() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
colors() {
|
get_line_break() {
|
||||||
# Reset colors/bold
|
line_break=" "
|
||||||
reset="\033[0m"
|
|
||||||
|
|
||||||
# Change color of logo based on distro
|
# Calculate info height
|
||||||
|
info_height="$((info_height+=1))"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_bold() {
|
||||||
|
case "$ascii_bold" in
|
||||||
|
"on") ascii_bold="\033[1m" ;;
|
||||||
|
"off") ascii_bold="" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$bold" in
|
||||||
|
"on") bold="\033[1m" ;;
|
||||||
|
"off") bold="" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
trim() {
|
||||||
|
# When a string is passed to 'echo' all trailing and leading
|
||||||
|
# whitespace is removed and inside the string multiple spaces are
|
||||||
|
# condensed into single spaces.
|
||||||
|
#
|
||||||
|
# The 'set -f/+f' is here so that 'echo' doesn't cause any expansion
|
||||||
|
# of special characters.
|
||||||
|
#
|
||||||
|
# The whitespace trim doesn't work with multiline strings so we use
|
||||||
|
# '${1//[[:space:]]/ }' to remove newlines beofre we trim the whitespace.
|
||||||
|
|
||||||
|
set -f
|
||||||
|
builtin echo -E ${1//[[:space:]]/ }
|
||||||
|
set +f
|
||||||
|
}
|
||||||
|
|
||||||
|
# COLORS
|
||||||
|
|
||||||
|
get_distro_colors() {
|
||||||
|
# This function sets the text colors according
|
||||||
|
# to your OS/Distro's logo colors.
|
||||||
|
#
|
||||||
|
# $ascii_distro is the same as $distro
|
||||||
case "$ascii_distro" in
|
case "$ascii_distro" in
|
||||||
"Arch"* | "Antergos"*)
|
"Arch"* | "Kogaion"* | "Elementary"* | "GalliumOS"* | "Rosa"* | "OpenWrt"* | "Netrunner"* | "PCLinuxOS"* | "Slackware"* | "KaOS"* | "Kubuntu"* | "Lubuntu"* | "Xubuntu"* | "OpenIndiana"* | "Fedora"* | "Korora"* | "Sabayon"* | "Frugalware"* | "Exherbo"* | "Scientific"* | "Solus"*)
|
||||||
setcolors 6 4
|
set_colors 4 7 1
|
||||||
;;
|
|
||||||
|
|
||||||
"BlankOn"* | "DracOS"*)
|
|
||||||
setcolors 1 7
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"CentOS"*)
|
"CentOS"*)
|
||||||
setcolors 3 2 4 5 7
|
set_colors 3 2 4 5 7
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"CRUX"* | "Chakra"* | "gNewSense"* | "SailfishOS"* | "Alpine"* | "Ubuntu-GNOME"* | "Qubes"*)
|
"CRUX"* | "Chakra"* | "gNewSense"* | "SailfishOS"* | "Alpine"* | "Ubuntu-GNOME"* | "Qubes"*)
|
||||||
setcolors 4 5 7 6
|
set_colors 4 5 7 6
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Chrom"*)
|
"Chrom"*)
|
||||||
setcolors 2 1 3 4 7
|
set_colors 2 1 3 4 7
|
||||||
ascii_distro="chrome"
|
ascii_distro="chrome"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Debian"* | "Ubuntu"* | "DragonFly"* | "PacBSD"* | "Oracle"*)
|
"Raspbian"*)
|
||||||
setcolors 1 7 3
|
set_colors 2 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Red Star"* | "Redstar")
|
"Debian"* | "Ubuntu"* | "DragonFly"* | "PacBSD"* | "Oracle" | "BlankOn"* | "DracOS"* | "Peppermint"*)
|
||||||
setcolors 1 7 3
|
set_colors 1 7 3
|
||||||
ascii_distro="redstar"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"FreeBSD"* | "PCBSD"*)
|
"FreeBSD"* | "PCBSD"*)
|
||||||
setcolors 1 7 3
|
set_colors 1 7 3
|
||||||
ascii_distro="freebsd"
|
ascii_distro="freebsd"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"Red Star"* | "Redstar")
|
||||||
|
set_colors 1 7 3
|
||||||
|
ascii_distro="redstar"
|
||||||
|
;;
|
||||||
|
|
||||||
"Red"*)
|
"Red"*)
|
||||||
setcolors 1 7 3
|
set_colors 1 7 3
|
||||||
ascii_distro="redhat"
|
ascii_distro="redhat"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Pardus"*)
|
|
||||||
setcolors 3 7
|
|
||||||
;;
|
|
||||||
|
|
||||||
"Kogaion"* | "Elementary"* | "GalliumOS"* | "Rosa"* | "OpenWrt"* | "Netrunner"*)
|
|
||||||
setcolors 4 7
|
|
||||||
;;
|
|
||||||
|
|
||||||
"Fedora"* | "Korora"* | "Sabayon"* | "Frugalware"* | "Exherbo"*)
|
|
||||||
setcolors 4 7 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
"Gentoo"* | "Funtoo"* | "SteamOS"* | "Devuan"*)
|
|
||||||
setcolors 5 7
|
|
||||||
;;
|
|
||||||
|
|
||||||
"KDE"*)
|
|
||||||
setcolors 2 7
|
|
||||||
ascii_distro="kde"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"Kali"*)
|
"Kali"*)
|
||||||
setcolors 4 8
|
set_colors 4 8
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"BunsenLabs"*)
|
"BunsenLabs"*)
|
||||||
setcolors 8 7
|
set_colors 8 7
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"OS X"* | *"iOS"* | "Mac" | *"macOS"*)
|
*"OS X"* | *"iOS"* | "Mac" | *"macOS"*)
|
||||||
setcolors 2 3 1 1 5 4
|
set_colors 2 3 1 1 5 4
|
||||||
ascii_distro="mac"
|
ascii_distro="mac"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"OpenMandriva"*)
|
"OpenMandriva"*)
|
||||||
setcolors 4 3
|
set_colors 4 3
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mageia"* | "Porteus"*)
|
"NetBSD"* | "Parabola"* | "Tails"* | "BLAG"* | "Gentoo"* | "Funtoo"* | "SteamOS"* | "Devuan"*)
|
||||||
setcolors 6 7
|
set_colors 5 7
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Peppermint"*)
|
"OpenBSD"* | "GuixSD"* | "Pardus"*)
|
||||||
setcolors 1 7
|
set_colors 3 7 6 1 8
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"Mint"*)
|
*"SUSE"* | "Manjaro"* | "Deepin"* |"LMDE"* | "Chapeau"* | "Bitrig"*)
|
||||||
setcolors 2 7
|
set_colors 2 7
|
||||||
ascii_distro="mint"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"LMDE"* | "Chapeau"* | "Bitrig"*)
|
"KDE"*)
|
||||||
setcolors 2 7
|
set_colors 2 7
|
||||||
|
ascii_distro="kde"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Android"*)
|
"Android"*)
|
||||||
setcolors 2 7
|
set_colors 2 7
|
||||||
ascii_length_force="19"
|
ascii_length_force="19"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"NetBSD"* | "Parabola"* | "Tails"* | "BLAG"*)
|
*"Mint"*)
|
||||||
setcolors 5 7
|
set_colors 2 7
|
||||||
;;
|
ascii_distro="mint"
|
||||||
|
|
||||||
"OpenBSD"* | "GuixSD"*)
|
|
||||||
setcolors 3 7 6 1 8
|
|
||||||
;;
|
|
||||||
|
|
||||||
*"SUSE"* | "Manjaro"* | "Deepin"*)
|
|
||||||
setcolors 2 7
|
|
||||||
;;
|
|
||||||
|
|
||||||
"PCLinuxOS"* | "Slackware"* | "KaOS"* | "Kubuntu"* | "Lubuntu"* | "Xubuntu"* | "OpenIndiana"*)
|
|
||||||
setcolors 4 7 1
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Puppy"* | "Quirky Werewolf"* | "Precise Puppy"*)
|
"Puppy"* | "Quirky Werewolf"* | "Precise Puppy"*)
|
||||||
setcolors 4 7
|
set_colors 4 7
|
||||||
ascii_distro="puppy"
|
ascii_distro="puppy"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Sparky"*)
|
"Sparky"*)
|
||||||
setcolors 1 7
|
set_colors 1 7
|
||||||
ascii_distro="sparky"
|
ascii_distro="sparky"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Scientific"*)
|
"Trisquel"* | "NixOS"* | "Zorin"* | "Antergos"*)
|
||||||
setcolors 4 1 7
|
set_colors 4 6
|
||||||
;;
|
|
||||||
|
|
||||||
"Solus"*)
|
|
||||||
setcolors 4 7
|
|
||||||
;;
|
|
||||||
|
|
||||||
"Trisquel"* | "NixOS"* | "Zorin"*)
|
|
||||||
setcolors 4 6
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Travis")
|
"Travis")
|
||||||
setcolors 1 2 3 4 5 6
|
set_colors 1 2 3 4 5 6
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"void"*)
|
"Void"* | "Haiku"*)
|
||||||
setcolors 2 8
|
set_colors 2 8
|
||||||
|
;;
|
||||||
|
|
||||||
|
"Mageia"* | "Porteus"*)
|
||||||
|
set_colors 6 7
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows 8"* | "Windows 10"*)
|
"Windows 8"* | "Windows 10"*)
|
||||||
setcolors 6 7
|
set_colors 6 7
|
||||||
ascii_distro="windows10"
|
ascii_distro="windows10"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows"*)
|
"Windows"*)
|
||||||
setcolors 1 2 4 3
|
set_colors 1 2 4 3
|
||||||
;;
|
|
||||||
|
|
||||||
"Haiku"*)
|
|
||||||
setcolors 2 0
|
|
||||||
;;
|
|
||||||
|
|
||||||
"Raspbian"*)
|
|
||||||
setcolors 2 1
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Linux")
|
"Linux")
|
||||||
setcolors fg 8 3
|
set_colors fg 8 3
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
case "$os" in
|
if [[ "$os" == "Linux" ]]; then
|
||||||
"Linux")
|
ascii_distro="linux"
|
||||||
ascii_distro="linux"
|
set_colors fg 8 3
|
||||||
setcolors fg 8 3
|
fi
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Overwrite distro colors if '$ascii_colors' doesn't
|
# Overwrite distro colors if '$ascii_colors' doesn't
|
||||||
# equal 'distro'.
|
# equal 'distro'.
|
||||||
[[ "${ascii_colors[0]}" != "distro" ]] && \
|
[[ "${ascii_colors[0]}" != "distro" ]] && \
|
||||||
setcolors ${ascii_colors[@]}
|
set_colors ${ascii_colors[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
setcolors() {
|
set_colors() {
|
||||||
|
# Ascii colors
|
||||||
c1="$(color "$1")${ascii_bold}"
|
c1="$(color "$1")${ascii_bold}"
|
||||||
c2="$(color "$2")${ascii_bold}"
|
c2="$(color "$2")${ascii_bold}"
|
||||||
c3="$(color "$3")${ascii_bold}"
|
c3="$(color "$3")${ascii_bold}"
|
||||||
|
@ -2564,6 +2559,7 @@ setcolors() {
|
||||||
c5="$(color "$5")${ascii_bold}"
|
c5="$(color "$5")${ascii_bold}"
|
||||||
c6="$(color "$6")${ascii_bold}"
|
c6="$(color "$6")${ascii_bold}"
|
||||||
|
|
||||||
|
# Text colors
|
||||||
if [[ "${colors[0]}" == "distro" ]]; then
|
if [[ "${colors[0]}" == "distro" ]]; then
|
||||||
title_color="$(color "$1")"
|
title_color="$(color "$1")"
|
||||||
at_color="$reset"
|
at_color="$reset"
|
||||||
|
@ -2584,16 +2580,17 @@ setcolors() {
|
||||||
info_color="$(color "${colors[5]}")"
|
info_color="$(color "${colors[5]}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$progress_color_elapsed" == "distro" ]]; then
|
# Bar colors
|
||||||
progress_color_elapsed="$(color fg)"
|
if [[ "$bar_color_elapsed" == "distro" ]]; then
|
||||||
|
bar_color_elapsed="$(color fg)"
|
||||||
else
|
else
|
||||||
progress_color_elapsed="$(color "$progress_color_elapsed")"
|
bar_color_elapsed="$(color "$bar_color_elapsed")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$progress_color_total $1" in
|
case "$bar_color_total $1" in
|
||||||
distro\ [736]) progress_color_total="$c2" ;;
|
"distro "[736]) bar_color_total="$c2" ;;
|
||||||
distro\ [0-9]) progress_color_total="$c1" ;;
|
"distro "[0-9]) bar_color_total="$c1" ;;
|
||||||
*) progress_color_total="$(color "$progress_color_total")" ;;
|
*) bar_color_total="$(color "$bar_color_total")" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2605,41 +2602,6 @@ color() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
bold() {
|
|
||||||
case "$ascii_bold" in
|
|
||||||
"on") ascii_bold="\033[1m" ;;
|
|
||||||
"off") ascii_bold="" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$bold" in
|
|
||||||
"on") bold="\033[1m" ;;
|
|
||||||
"off") bold="" ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
get_line_break() {
|
|
||||||
line_break=" "
|
|
||||||
|
|
||||||
# Calculate info height
|
|
||||||
info_height="$((info_height+=1))"
|
|
||||||
}
|
|
||||||
|
|
||||||
trim() {
|
|
||||||
# When a string is passed to 'echo' all trailing and leading
|
|
||||||
# whitespace is removed and inside the string multiple spaces are
|
|
||||||
# condensed into single spaces.
|
|
||||||
#
|
|
||||||
# The 'set -f/+f' is here so that 'echo' doesn't cause any expansion
|
|
||||||
# of special characters.
|
|
||||||
#
|
|
||||||
# The whitespace trim doesn't work with multiline strings so we use
|
|
||||||
# '${1//[[:space:]]/ }' to remove newlines beofre we trim the whitespace.
|
|
||||||
|
|
||||||
set -f
|
|
||||||
builtin echo -E ${1//[[:space:]]/ }
|
|
||||||
set +f
|
|
||||||
}
|
|
||||||
|
|
||||||
# OTHER
|
# OTHER
|
||||||
|
|
||||||
err() {
|
err() {
|
||||||
|
@ -2728,21 +2690,19 @@ get_user_config() {
|
||||||
|
|
||||||
bar() {
|
bar() {
|
||||||
# Get the values
|
# Get the values
|
||||||
elapsed="$(($1 * progress_length / $2))"
|
elapsed="$(($1 * bar_length / $2))"
|
||||||
|
|
||||||
# Create the bar with spaces
|
# Create the bar with spaces
|
||||||
prog="$(printf %"$elapsed"s)"
|
prog="$(printf %"$elapsed"s)"
|
||||||
total="$(printf %"$((progress_length - elapsed))"s)"
|
total="$(printf %"$((bar_length - elapsed))"s)"
|
||||||
|
|
||||||
# Set the colors and swap the spaces for $progress_char
|
# Set the colors and swap the spaces for $bar_char_
|
||||||
bar+="${progress_color_elapsed}${prog// /$progress_char_elapsed}"
|
bar+="${bar_color_elapsed}${prog// /$bar_char_elapsed}"
|
||||||
bar+="${progress_color_total}${total// /$progress_char_total}"
|
bar+="${bar_color_total}${total// /$bar_char_total}"
|
||||||
|
|
||||||
# Borders
|
# Borders
|
||||||
if [[ "$progress_border" == "on" ]]; then
|
[[ "$bar_border" == "on" ]] && \
|
||||||
bar+="$(color fg)]"
|
bar="$(color fg)[${bar}$(color fg)]"
|
||||||
bar="$(color fg)[$bar"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "%b\n" "${bar}${info_color}"
|
printf "%b\n" "${bar}${info_color}"
|
||||||
}
|
}
|
||||||
|
@ -2753,6 +2713,8 @@ cache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
kde_config_dir() {
|
kde_config_dir() {
|
||||||
|
# If the user is using KDE get the KDE
|
||||||
|
# configuration directory.
|
||||||
if [[ "$kde_config_dir" ]]; then
|
if [[ "$kde_config_dir" ]]; then
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2792,9 +2754,10 @@ get_term_padding() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic_prompt() {
|
dynamic_prompt() {
|
||||||
# Calculate image height in terminal cells.
|
if [[ "$image_backend" == "image" ]]; then
|
||||||
if [[ "$image_backend" != "ascii" ]]; then
|
|
||||||
get_term_padding 2>/dev/null
|
get_term_padding 2>/dev/null
|
||||||
|
|
||||||
|
# Calculate image height in terminal cells.
|
||||||
lines="$(((height + (${border:-0} * 2) + ${yoffset:-0}) / font_height))"
|
lines="$(((height + (${border:-0} * 2) + ${yoffset:-0}) / font_height))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2836,9 +2799,15 @@ old_functions() {
|
||||||
old_flags() {
|
old_flags() {
|
||||||
[[ -n "$osx_buildversion" ]] && err "Config: \$osx_buildversion is deprecated, use \$distro_shorthand instead."
|
[[ -n "$osx_buildversion" ]] && err "Config: \$osx_buildversion is deprecated, use \$distro_shorthand instead."
|
||||||
[[ -n "$osx_codename" ]] && err "Config: \$osx_codename is deprecated, use \$distro_shorthand instead."
|
[[ -n "$osx_codename" ]] && err "Config: \$osx_codename is deprecated, use \$distro_shorthand instead."
|
||||||
[[ -n "$progress_char" ]] && err "Config: \$progress_char is deprecated, use \$progress_char_elapsed and \$progress_char_total instead."
|
|
||||||
[[ "$cpu_cores" == "on" ]] && err "Config: \$cpu_cores='on' is deprecated, use \$cpu_cores='logical|physical|off' instead."
|
[[ "$cpu_cores" == "on" ]] && err "Config: \$cpu_cores='on' is deprecated, use \$cpu_cores='logical|physical|off' instead."
|
||||||
[[ -n "$image" ]] && { err "Config: \$image is deprecated, use \$image_source instead."; image_source="$image"; }
|
[[ -n "$image" ]] && { err "Config: \$image is deprecated, use \$image_source instead."; image_source="$image"; }
|
||||||
|
|
||||||
|
# All progress_ variables were changed to bar_
|
||||||
|
[[ -n "$progress_char" ]] && err "Config: \$progress_char is deprecated, use \$bar_char_elapsed and \$bar_char_total instead."
|
||||||
|
[[ -n "$progress_border" ]] && err "Config: \$progress_border is deprecated, use \$bar_border instead."
|
||||||
|
[[ -n "$progress_length" ]] && err "Config: \$progress_length is deprecated, use \$bar_length instead."
|
||||||
|
[[ -n "$progress_color_elapsed" ]] && err "Config: \$progress_color_elapsed is deprecated, use \$bar_color_elapsed instead."
|
||||||
|
[[ -n "$progress_color_total" ]] && err "Config: \$progress_color_total is deprecated, use \$bar_color_total instead."
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_uname() {
|
cache_uname() {
|
||||||
|
@ -2910,20 +2879,20 @@ usage() { printf "%s" "
|
||||||
--block_height num Height of color blocks in lines
|
--block_height num Height of color blocks in lines
|
||||||
--block_range start end Range of colors to print as blocks
|
--block_range start end Range of colors to print as blocks
|
||||||
|
|
||||||
Progress Bars:
|
Bars:
|
||||||
--progress_char 'elapsed char' 'total char'
|
--bar_char 'elapsed char' 'total char'
|
||||||
Characters to use when drawing progress bars.
|
Characters to use when drawing bars.
|
||||||
--progress_border on/off Whether or not to surround the bar with '[]'
|
--bar_border on/off Whether or not to surround the bar with '[]'
|
||||||
--progress_length num Length in spaces to make the progress bars.
|
--bar_length num Length in spaces to make the bars.
|
||||||
--progress_colors num num Colors to make the progress bar.
|
--bar_colors num num Colors to make the bar.
|
||||||
Set in this order: elapsed, total
|
Set in this order: elapsed, total
|
||||||
--cpu_display mode Progress bar mode.
|
--cpu_display mode Bar mode.
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
--memory_display mode Progress bar mode.
|
--memory_display mode Bar mode.
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
--battery_display mode Progress bar mode.
|
--battery_display mode Bar mode.
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
--disk_display mode Progress bar mode.
|
--disk_display mode Bar mode.
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
|
|
||||||
Image:
|
Image:
|
||||||
|
@ -3048,16 +3017,16 @@ get_args() {
|
||||||
--block_width) block_width="$2" ;;
|
--block_width) block_width="$2" ;;
|
||||||
--block_height) block_height="$2" ;;
|
--block_height) block_height="$2" ;;
|
||||||
|
|
||||||
# Progress Bars
|
# Bars
|
||||||
--progress_char)
|
--bar_char)
|
||||||
progress_char_elapsed="$2"
|
bar_char_elapsed="$2"
|
||||||
progress_char_total="$3"
|
bar_char_total="$3"
|
||||||
;;
|
;;
|
||||||
--progress_border) progress_border="$2" ;;
|
--bar_border) bar_border="$2" ;;
|
||||||
--progress_length) progress_length="$2" ;;
|
--bar_length) bar_length="$2" ;;
|
||||||
--progress_colors)
|
--bar_colors)
|
||||||
progress_color_elapsed="$2"
|
bar_color_elapsed="$2"
|
||||||
progress_color_total="$3"
|
bar_color_total="$3"
|
||||||
;;
|
;;
|
||||||
--cpu_display) cpu_display="$2" ;;
|
--cpu_display) cpu_display="$2" ;;
|
||||||
--memory_display) memory_display="$2" ;;
|
--memory_display) memory_display="$2" ;;
|
||||||
|
@ -3149,11 +3118,11 @@ main() {
|
||||||
cache_uname
|
cache_uname
|
||||||
get_os
|
get_os
|
||||||
get_default_config 2>/dev/null
|
get_default_config 2>/dev/null
|
||||||
old_flags
|
|
||||||
get_args "$@"
|
get_args "$@"
|
||||||
|
old_flags
|
||||||
get_distro
|
get_distro
|
||||||
bold
|
get_bold
|
||||||
colors
|
get_distro_colors
|
||||||
|
|
||||||
# Restore cursor and clear screen on ctrl+c
|
# Restore cursor and clear screen on ctrl+c
|
||||||
trap 'printf "\033[?25h"; clear; exit' 2
|
trap 'printf "\033[?25h"; clear; exit' 2
|
||||||
|
|
24
neofetch.1
24
neofetch.1
|
@ -132,39 +132,39 @@ Height of color blocks in lines
|
||||||
.B \--block_range 'start' 'end'
|
.B \--block_range 'start' 'end'
|
||||||
Range of colors to print as blocks
|
Range of colors to print as blocks
|
||||||
|
|
||||||
.SH PROGRESS BARS
|
.SH BARS
|
||||||
.TP
|
.TP
|
||||||
.B \--progress_char 'elapsed char' 'total char'
|
.B \--bar_char 'elapsed char' 'total char'
|
||||||
Characters to use when drawing progress bars.
|
Characters to use when drawing bars.
|
||||||
.TP
|
.TP
|
||||||
.B \--progress_border on/off
|
.B \--bar_border on/off
|
||||||
Whether or not to surround the bar with '[]'
|
Whether or not to surround the bar with '[]'
|
||||||
.TP
|
.TP
|
||||||
.B \--progress_length 'num'
|
.B \--bar_length 'num'
|
||||||
Length in spaces to make the progress bars.
|
Length in spaces to make the bars.
|
||||||
.TP
|
.TP
|
||||||
.B \--progress_colors 'num' 'num'
|
.B \--bar_colors 'num' 'num'
|
||||||
Colors to make the progress bar.
|
Colors to make the bar.
|
||||||
.br
|
.br
|
||||||
Set in this order: elapsed, total
|
Set in this order: elapsed, total
|
||||||
.TP
|
.TP
|
||||||
.B \--cpu_display 'mode'
|
.B \--cpu_display 'mode'
|
||||||
Progress bar mode.
|
Bar mode.
|
||||||
.br
|
.br
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
.TP
|
.TP
|
||||||
.B \--memory_display 'mode'
|
.B \--memory_display 'mode'
|
||||||
Progress bar mode.
|
Bar mode.
|
||||||
.br
|
.br
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
.TP
|
.TP
|
||||||
.B \--battery_display 'mode'
|
.B \--battery_display 'mode'
|
||||||
Progress bar mode.
|
Bar mode.
|
||||||
.br
|
.br
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
.TP
|
.TP
|
||||||
.B \--disk_display 'mode'
|
.B \--disk_display 'mode'
|
||||||
Progress bar mode.
|
Bar mode.
|
||||||
.br
|
.br
|
||||||
Takes: bar, infobar, barinfo, off
|
Takes: bar, infobar, barinfo, off
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue