neofetch: remove unneeded quotes

This commit is contained in:
Dylan Araps 2019-10-28 22:15:57 +00:00
parent acdfbe2063
commit 9f25f34fa1
No known key found for this signature in database
GPG key ID: 46D62DD9F1DE636E

152
neofetch
View file

@ -1698,7 +1698,7 @@ get_wm_theme() {
((wm_run != 1)) && get_wm
((de_run != 1)) && get_de
case "$wm" in
case $wm in
"E16")
wm_theme="$(awk -F "= " '/theme.name/ {print $2}' "${HOME}/.e16/e_config--0.0.cfg")"
;;
@ -1820,7 +1820,7 @@ get_wm_theme() {
[[ -z "$wm_theme" ]] && \
wm_theme="Light"
case "$wm_theme_color" in
case $wm_theme_color in
"-1") wm_theme_color="Graphite" ;;
"0") wm_theme_color="Red" ;;
"1") wm_theme_color="Orange" ;;
@ -1858,12 +1858,12 @@ get_wm_theme() {
}
get_cpu() {
case "$os" in
case $os in
"Linux" | "MINIX" | "Windows")
# Get CPU name.
cpu_file="/proc/cpuinfo"
case "$kernel_machine" in
case $kernel_machine in
"frv" | "hppa" | "m68k" | "openrisc" | "or"* | "powerpc" | "ppc"* | "sparc"*)
cpu="$(awk -F':' '/^cpu\t|^CPU/ {printf $2; exit}' "$cpu_file")"
;;
@ -1910,7 +1910,7 @@ get_cpu() {
[[ -f "$temp_dir" ]] && deg="$(($(< "$temp_dir") * 100 / 10000))"
# Get CPU cores.
case "$cpu_cores" in
case $cpu_cores in
"logical" | "on") cores="$(grep -c "^processor" "$cpu_file")" ;;
"physical") cores="$(awk '/^core id/&&!a[$0]++{++i} END {print i}' "$cpu_file")" ;;
esac
@ -1920,14 +1920,14 @@ get_cpu() {
cpu="$(sysctl -n machdep.cpu.brand_string)"
# Get CPU cores.
case "$cpu_cores" in
case $cpu_cores in
"logical" | "on") cores="$(sysctl -n hw.logicalcpu_max)" ;;
"physical") cores="$(sysctl -n hw.physicalcpu_max)" ;;
esac
;;
"iPhone OS")
case "$kernel_machine" in
case $kernel_machine in
"iPhone1,"[1-2] | "iPod1,1"): "Samsung S5L8900 (1) @ 412MHz" ;;
"iPhone2,1"): "Samsung S5PC100 (1) @ 600MHz" ;;
"iPhone3,"[1-3] | "iPod4,1"): "Apple A4 (1) @ 800MHz" ;;
@ -1976,7 +1976,7 @@ get_cpu() {
cores="$(sysctl -n hw.ncpu)"
# Get CPU temp.
case "$kernel_name" in
case $kernel_name in
"FreeBSD"* | "DragonFly"* | "NetBSD"*)
deg="$(sysctl -n dev.cpu.0.temperature)"
deg="${deg/C}"
@ -2001,7 +2001,7 @@ get_cpu() {
speed="$(psrinfo -v | awk '/operates at/ {print $6; exit}')"
# Get CPU cores.
case "$cpu_cores" in
case $cpu_cores in
"logical" | "on") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
"physical") cores="$(psrinfo -p)" ;;
esac
@ -2029,7 +2029,7 @@ get_cpu() {
speed="${speed/MHz}"
# Get CPU cores.
case "$cpu_cores" in
case $cpu_cores in
"logical" | "on")
cores="$(lparstat -i | awk -F':' '/Online Virtual CPUs/ {printf $2}')"
;;
@ -2092,7 +2092,7 @@ get_cpu() {
# Add CPU cores to the output.
[[ "$cpu_cores" != "off" && "$cores" ]] && \
case "$os" in
case $os in
"Mac OS X") cpu="${cpu/@/(${cores}) @}" ;;
*) cpu="$cpu ($cores)" ;;
esac
@ -2122,7 +2122,7 @@ get_cpu() {
}
get_cpu_usage() {
case "$os" in
case $os in
"Windows")
cpu_usage="$(wmic cpu get loadpercentage)"
cpu_usage="${cpu_usage/LoadPercentage}"
@ -2132,7 +2132,7 @@ get_cpu_usage() {
*)
# Get CPU cores if unset.
if [[ "$cpu_cores" != "logical" ]]; then
case "$os" in
case $os in
"Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
"Mac OS X") cores="$(sysctl -n hw.logicalcpu_max)" ;;
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
@ -2154,7 +2154,7 @@ get_cpu_usage() {
esac
# Print the bar.
case "$cpu_display" in
case $cpu_display in
"bar") cpu_usage="$(bar "$cpu_usage" 100)" ;;
"infobar") cpu_usage="${cpu_usage}% $(bar "$cpu_usage" 100)" ;;
"barinfo") cpu_usage="$(bar "$cpu_usage" 100)${info_color} ${cpu_usage}%" ;;
@ -2163,7 +2163,7 @@ get_cpu_usage() {
}
get_gpu() {
case "$os" in
case $os in
"Linux")
# Read GPUs into array.
gpu_cmd="$(lspci -mm | awk -F '\"|\" \"|\\(' \
@ -2186,7 +2186,7 @@ get_gpu() {
[[ "$gpu_type" == "integrated" && ! "$gpu" == *Intel* ]] && \
{ unset -v gpu; continue; }
case "$gpu" in
case $gpu in
*"advanced"*)
brand="${gpu/*AMD*ATI*/AMD ATI}"
brand="${brand:-${gpu/*AMD*/AMD}}"
@ -2252,7 +2252,7 @@ get_gpu() {
;;
"iPhone OS")
case "$kernel_machine" in
case $kernel_machine in
"iPhone1,"[1-2]): "PowerVR MBX Lite 3D" ;;
"iPhone5,"[1-4]): "PowerVR SGX543MP3" ;;
"iPhone11,"[2468]): "G11P" ;;
@ -2303,7 +2303,7 @@ get_gpu() {
;;
*)
case "$kernel_name" in
case $kernel_name in
"FreeBSD"* | "DragonFly"*)
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
gpu="${gpu/*device*= }"
@ -2326,12 +2326,12 @@ get_gpu() {
}
get_memory() {
case "$os" in
case $os in
"Linux" | "Windows")
# MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
# Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716
while IFS=":" read -r a b; do
case "$a" in
case $a in
"MemTotal") ((mem_used+=${b/kB})); mem_total="${b/kB}" ;;
"Shmem") ((mem_used+=${b/kB})) ;;
"MemFree" | "Buffers" | "Cached" | "SReclaimable")
@ -2355,13 +2355,13 @@ get_memory() {
"BSD" | "MINIX")
# Mem total.
case "$kernel_name" in
case $kernel_name in
"NetBSD"*) mem_total="$(($(sysctl -n hw.physmem64) / 1024 / 1024))" ;;
*) mem_total="$(($(sysctl -n hw.physmem) / 1024 / 1024))" ;;
esac
# Mem free.
case "$kernel_name" in
case $kernel_name in
"NetBSD"*)
mem_free="$(($(awk -F ':|kB' '/MemFree:/ {printf $2}' /proc/meminfo) / 1024))"
;;
@ -2384,7 +2384,7 @@ get_memory() {
esac
# Mem used.
case "$kernel_name" in
case $kernel_name in
"OpenBSD"*)
mem_used="$(vmstat | awk 'END {printf $3}')"
mem_used="${mem_used/M}"
@ -2396,7 +2396,7 @@ get_memory() {
"Solaris" | "AIX")
hw_pagesize="$(pagesize)"
case "$os" in
case $os in
"Solaris")
pages_total="$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')"
pages_free="$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')"
@ -2444,7 +2444,7 @@ get_memory() {
memory="${mem_used}${mem_label:-MiB} / ${mem_total}${mem_label:-MiB} ${mem_perc:+(${mem_perc}%)}"
# Bars.
case "$memory_display" in
case $memory_display in
"bar") memory="$(bar "${mem_used}" "${mem_total}")" ;;
"infobar") memory="${memory} $(bar "${mem_used}" "${mem_total}")" ;;
"barinfo") memory="$(bar "${mem_used}" "${mem_total}")${info_color} ${memory}" ;;
@ -2513,7 +2513,7 @@ get_song() {
)"
}
case "${player/*\/}" in
case ${player/*\/} in
"mpd"*|"mopidy"*) song="$(mpc -f '%artist%\n%album%\n%title%' current "${mpc_args[@]}")" ;;
"mocp"*) song="$(mocp -Q '%artist\n%album\n%song')" ;;
"deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist%\\n%album%\\n%title%')" ;;
@ -2561,7 +2561,7 @@ get_song() {
;;
"spotify"*)
case "$os" in
case $os in
"Linux") get_song_dbus "spotify" ;;
"Mac OS X")
@ -2638,7 +2638,7 @@ get_song() {
}
get_resolution() {
case "$os" in
case $os in
"Mac OS X")
if type -p screenresolution >/dev/null; then
resolution="$(screenresolution get 2>&1 | awk '/Display/ {printf $6 "Hz, "}')"
@ -2692,7 +2692,7 @@ get_resolution() {
*)
if type -p xrandr >/dev/null; then
case "$refresh_rate" in
case $refresh_rate in
"on")
resolution="$(xrandr --nograb --current |\
awk 'match($0,/[0-9]*\.[0-9]*\*/) {
@ -2732,7 +2732,7 @@ get_style() {
((de_run != 1)) && get_de
# Check for DE Theme.
case "$de" in
case $de in
"KDE"* | "Plasma"*)
kde_config_dir
@ -2895,7 +2895,7 @@ get_term() {
# Workaround for macOS systems that
# don't support the block below.
case "$TERM_PROGRAM" in
case $TERM_PROGRAM in
"iTerm.app") term="iTerm2" ;;
"Terminal.app") term="Apple Terminal" ;;
"Hyper") term="HyperTerm" ;;
@ -2912,7 +2912,7 @@ get_term() {
[[ -z "$parent" ]] && break
name="$(get_process_name "$parent")"
case "${name// }" in
case ${name// } in
"${SHELL/*\/}"|*"sh"|"screen"|"su"*) ;;
"login"*|*"Login"*|"init"|"(init)")
@ -2950,7 +2950,7 @@ get_term() {
get_term_font() {
((term_run != 1)) && get_term
case "$term" in
case $term in
"alacritty"*)
shopt -s nullglob
confs=({$XDG_CONFIG_HOME,$HOME}/{alacritty,}/{.,}alacritty.ym?)
@ -3204,7 +3204,7 @@ END
# Xresources has two different font formats, this checks which
# one is in use and formats it accordingly.
case "$term_font" in
case $term_font in
*"xft:"*)
term_font="${term_font/xft:}"
term_font="${term_font/:*}"
@ -3237,7 +3237,7 @@ get_disk() {
df_version="$(df --version 2>&1)"
case "$df_version" in
case $df_version in
*"IMitv"*) df_flags=(-P -g) ;; # AIX
*"befhikm"*) df_flags=(-P -k) ;; # IRIX
*"hiklnP"*) df_flags=(-h) ;; # OpenBSD
@ -3266,7 +3266,7 @@ get_disk() {
IFS=" " read -ra disk_info <<< "$disk"
disk_perc="${disk_info[4]/\%}"
case "$df_version" in
case $df_version in
*"befhikm"*)
disk="$((disk_info[2]/1024/1024))G / $((disk_info[1]/1024/1024))G (${disk_perc}%)"
;;
@ -3277,7 +3277,7 @@ get_disk() {
esac
# Subtitle.
case "$disk_subtitle" in
case $disk_subtitle in
"name")
disk_sub="${disk_info[0]}"
;;
@ -3293,7 +3293,7 @@ get_disk() {
esac
# Bar.
case "$disk_display" in
case $disk_display in
"bar") disk="$(bar "$disk_perc" "100")" ;;
"infobar") disk+=" $(bar "$disk_perc" "100")" ;;
"barinfo") disk="$(bar "$disk_perc" "100")${info_color} $disk" ;;
@ -3310,7 +3310,7 @@ get_disk() {
}
get_battery() {
case "$os" in
case $os in
"Linux")
# We use 'prin' here so that we can do multi battery support
# with a single battery per line.
@ -3321,7 +3321,7 @@ get_battery() {
if [[ "$capacity" ]]; then
battery="${capacity}% [${status}]"
case "$battery_display" in
case $battery_display in
"bar") battery="$(bar "$capacity" 100)" ;;
"infobar") battery+=" $(bar "$capacity" 100)" ;;
"barinfo") battery="$(bar "$capacity" 100)${info_color} ${battery}" ;;
@ -3335,7 +3335,7 @@ get_battery() {
;;
"BSD")
case "$kernel_name" in
case $kernel_name in
"FreeBSD"* | "DragonFly"*)
battery="$(acpiconf -i 0 | awk -F ':\t' '/Remaining capacity/ {print $2}')"
battery_state="$(acpiconf -i 0 | awk -F ':\t\t\t' '/State/ {print $2}')"
@ -3387,7 +3387,7 @@ get_battery() {
[[ "$battery_state" ]] && battery+=" Charging"
case "$battery_display" in
case $battery_display in
"bar") battery="$(bar "${battery/\%*}" 100)" ;;
"infobar") battery="${battery} $(bar "${battery/\%*}" 100)" ;;
"barinfo") battery="$(bar "${battery/\%*}" 100)${info_color} ${battery}" ;;
@ -3395,7 +3395,7 @@ get_battery() {
}
get_local_ip() {
case "$os" in
case $os in
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX")
local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')"
local_ip="${local_ip/uid*}"
@ -3453,7 +3453,7 @@ get_locale() {
}
get_gpu_driver() {
case "$os" in
case $os in
"Linux")
gpu_driver="$(lspci -nnk | awk -F ': ' \
'/Display|3D|VGA/{nr[NR+2]}; NR in nr {printf $2 ", "}')"
@ -3485,7 +3485,7 @@ get_cols() {
# Generate the string.
for ((block_range[0]; block_range[0]<=block_range[1]; block_range[0]++)); do
case "${block_range[0]}" in
case ${block_range[0]} in
[0-7])
printf -v blocks '%b\e[3%bm\e[4%bm%b' \
"$blocks" "${block_range[0]}" "${block_range[0]}" "$block_width"
@ -3531,7 +3531,7 @@ image_backend() {
[[ "$image_backend" != "off" ]] && ! type -p convert &>/dev/null && \
{ image_backend="ascii"; err "Image: Imagemagick not found, falling back to ascii mode."; }
case "${image_backend:-off}" in
case ${image_backend:-off} in
"ascii") print_ascii ;;
"off") image_backend="off" ;;
@ -3606,7 +3606,7 @@ print_ascii() {
}
get_image_source() {
case "$image_source" in
case $image_source in
"auto" | "wall" | "wallpaper")
get_wallpaper
;;
@ -3631,7 +3631,7 @@ get_image_source() {
}
get_wallpaper() {
case "$os" in
case $os in
"Mac OS X")
image="$(osascript <<END
tell application "System Events" to picture of current desktop
@ -3640,7 +3640,7 @@ END
;;
"Windows")
case "$distro" in
case $distro in
"Windows XP")
image="/c/Documents and Settings/${USER}"
image+="/Local Settings/Application Data/Microsoft/Wallpaper1.bmp"
@ -3661,7 +3661,7 @@ END
type -p wal >/dev/null && [[ -f "${HOME}/.cache/wal/wal" ]] && \
{ image="$(< "${HOME}/.cache/wal/wal")"; return; }
case "$de" in
case $de in
"MATE"*)
image="$(gsettings get org.mate.background picture-filename)"
;;
@ -3739,7 +3739,7 @@ get_window_size() {
printf '%b' '\e}qs\000'
elif [[ -z $VTE_VERSION ]]; then
case "${TMUX:-null}" in
case ${TMUX:-null} in
"null") printf '%b' '\e[14t' ;;
*) printf '%b' '\ePtmux;\e\e[14t\e\\ ' ;;
esac
@ -3749,7 +3749,7 @@ get_window_size() {
# user input so we have to use read to store the out
# -put as a variable.
# The 1 second timeout is required for older bash
case "${BASH_VERSINFO[0]}" in
case ${BASH_VERSINFO[0]} in
4|5) IFS=';t' read -d t -t 0.05 -sra term_size ;;
*) IFS=';t' read -d t -t 1 -sra term_size ;;
esac
@ -3819,7 +3819,7 @@ get_image_size() {
# This functions determines the size to make the thumbnail image.
get_term_size
case "$image_size" in
case $image_size in
"auto")
image_size="$((columns * font_width / 2))"
term_height="$((term_height - term_height / 4))"
@ -3864,7 +3864,7 @@ make_thumbnail() {
image_name="${crop_mode}-${crop_offset}-${width}-${height}-${image//\/}"
# Handle file extensions.
case "${image##*.}" in
case ${image##*.} in
"eps"|"pdf"|"svg"|"gif"|"png")
image_name+=".png" ;;
*) image_name+=".jpg" ;;
@ -3880,7 +3880,7 @@ make_thumbnail() {
((og_height > og_width)) && size="$og_width" || size="$og_height"
}
case "$crop_mode" in
case $crop_mode in
"fit")
c="$(convert "$image" \
-colorspace srgb \
@ -3929,7 +3929,7 @@ make_thumbnail() {
}
display_image() {
case "$image_backend" in
case $image_backend in
"caca")
img2txt \
-W "$((width / font_width))" \
@ -4096,12 +4096,12 @@ get_underline() {
}
get_bold() {
case "$ascii_bold" in
case $ascii_bold in
"on") ascii_bold='\e[1m' ;;
"off") ascii_bold="" ;;
esac
case "$bold" in
case $bold in
"on") bold='\e[1m' ;;
"off") bold="" ;;
esac
@ -4177,15 +4177,15 @@ set_text_colors() {
bar_color_elapsed="$(color "$bar_color_elapsed")"
fi
case "$bar_color_total $1" in
"distro "[736]) bar_color_total="$(color "$1")" ;;
"distro "[0-9]) bar_color_total="$(color "$2")" ;;
*) bar_color_total="$(color "$bar_color_total")" ;;
case ${bar_color_total}${1} in
distro[736]) bar_color_total=$(color "$1") ;;
distro[0-9]) bar_color_total=$(color "$2") ;;
*) bar_color_total=$(color "$bar_color_total") ;;
esac
}
color() {
case "$1" in
case $1 in
[0-6]) printf '%b\e[3%sm' "$reset" "$1" ;;
7 | "fg") printf '\e[37m%b' "$reset" ;;
*) printf '\e[38;5;%bm' "$1" ;;
@ -4285,7 +4285,7 @@ cache() {
}
get_cache_dir() {
case "$os" in
case $os in
"Mac OS X") cache_dir="/Library/Caches" ;;
*) cache_dir="/tmp" ;;
esac
@ -4320,7 +4320,7 @@ term_padding() {
# Get terminal padding to properly align cursor.
[[ -z "$term" ]] && get_term
case "$term" in
case $term in
urxvt*|"rxvt-unicode")
[[ -z "$xrdb" ]] &&
xrdb="$(xrdb -query)"
@ -4373,7 +4373,7 @@ cache_uname() {
get_ppid() {
# Get parent process ID of PID.
case "$os" in
case $os in
"Windows")
ppid="$(ps -p "${1:-$PPID}" | awk '{printf $2}')"
ppid="${ppid/PPID}"
@ -4394,7 +4394,7 @@ get_ppid() {
get_process_name() {
# Get PID name.
case "$os" in
case $os in
"Windows")
name="$(ps -p "${1:-$PPID}" | awk '{printf $8}')"
name="${name/COMMAND}"
@ -4654,7 +4654,7 @@ get_args() {
[[ "$*" != *--config* && "$*" != *--no_config* ]] && get_user_config
while [[ "$1" ]]; do
case "$1" in
case $1 in
# Info
"--package_managers") package_managers="$2" ;;
"--os_arch") os_arch="$2" ;;
@ -4689,7 +4689,7 @@ get_args() {
"--disk_show")
unset disk_show
for arg in "$@"; do
case "$arg" in
case $arg in
"--disk_show") ;;
"-"*) break ;;
*) disk_show+=("$arg") ;;
@ -4699,7 +4699,7 @@ get_args() {
"--disable")
for func in "$@"; do
case "$func" in
case $func in
"--disable") continue ;;
"-"*) break ;;
*)
@ -4714,7 +4714,7 @@ get_args() {
"--colors")
unset colors
for arg in "$2" "$3" "$4" "$5" "$6" "$7"; do
case "$arg" in
case $arg in
"-"*) break ;;
*) colors+=("$arg") ;;
esac
@ -4758,7 +4758,7 @@ get_args() {
"--ascii" | "--caca" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty")
image_backend="${1/--}"
case "$2" in
case $2 in
"-"* | "") ;;
*) image_source="$2" ;;
esac
@ -4783,7 +4783,7 @@ get_args() {
"--ascii_colors")
unset ascii_colors
for arg in "$2" "$3" "$4" "$5" "$6" "$7"; do
case "$arg" in
case $arg in
"-"*) break ;;
*) ascii_colors+=("$arg")
esac
@ -4804,7 +4804,7 @@ get_args() {
# Other
"--config")
case "$2" in
case $2 in
"none" | "off" | "") ;;
*)
config_file="$(get_full_path "$2")"
@ -4922,7 +4922,7 @@ get_distro_ascii() {
# This function gets the distro ascii art and colors.
#
# $ascii_distro is the same as $distro.
case "$(trim "$ascii_distro")" in
case $(trim "$ascii_distro") in
"AIX"*)
set_colors 2 7
read -rd '' ascii_data <<'EOF'
@ -9400,7 +9400,7 @@ EOF
;;
*)
case "$kernel_name" in
case $kernel_name in
*"BSD")
set_colors 1 7 4 3 6
read -rd '' ascii_data <<'EOF'