diff --git a/1.8.md b/1.8.md
index d513413a..1179b2ff 100644
--- a/1.8.md
+++ b/1.8.md
@@ -38,6 +38,7 @@ bottom of the window. See [#279](https://github.com/dylanaraps/neofetch/pull/279
- `-v` now shows where the config files were sourced from.
- Removed in-script config in favor of sourcing the default user config.
- Moved commands near the bottom of the script to a new function called `main`.
+- Use `read -s` instead of `stty -echo` and `stty +echo`.
- Cleanup
@@ -75,6 +76,11 @@ bottom of the window. See [#279](https://github.com/dylanaraps/neofetch/pull/279
- Use faster `$(())` syntax for index variables.
+**Title**
+
+- Added additional fallback which gets the current username from `$HOME`.
+
+
**Color Blocks**
- Added `--block_height` / `$block_height` to change the number of lines high each
@@ -103,11 +109,14 @@ block will be.
- [Cmus] The function now works on both OS X and Linux.
- [iTunes] Fix song not displaying. **[@iandrewt](https://github.com/iandrewt)**
+**CPU**
+- Simplify CPU Core command.
+
**CPU Usage**
-- Fixed broken CPU usage output on BSD and Windows
-- Fixed misleading output on Linux / Mac OS X
-- Moved CPU Usage to its own dedicated function
+- Fixed broken CPU usage output on BSD and Windows.
+- Fixed misleading output on Linux / Mac OS X.
+- Moved CPU Usage to its own dedicated function.
### Image
@@ -142,4 +151,5 @@ distro ascii files. See this wiki page that explains the syntax. [Link](https://
- Fix a color issue with Debian's ascii logo.
- Added `--ascii_distro mac` as a shorter way of using the OS X ascii.
- Added missing `$ascii_distro` config option.
+- Use a pure bash solution to getting ascii size.
diff --git a/ascii/distro/peppermint b/ascii/distro/peppermint
index 69eaf160..cefc918f 100644
--- a/ascii/distro/peppermint
+++ b/ascii/distro/peppermint
@@ -1,21 +1,21 @@
"\
-${c1} 8ZZZZZZ${c2}MMMMM
-${c1} .ZZZZZZZZZ${c2}MMMMMMM.
-${c2} MM${c1}ZZZZZZZZZ${c2}MMMMMMM${c1}ZZZZ
-${c2} MMMMM${c1}ZZZZZZZZ${c2}MMMMM${c1}ZZZZZZZM
-${c2} MMMMMMM${c1}ZZZZZZZ${c2}MMMM${c1}ZZZZZZZ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ZZZ${c2}MMMMMMMMMM${c1}IZZ${c2}MM${c1}ZZZZZ${c2}MMMMMMMMM
+${c1}ZZZZZZZ${c2}MMMMMMMM${c1}ZZ${c2}M${c1}ZZZZ${c2}MMMMMMMMMMM
+${c1}ZZZZZZZZZZZZZZZZ${c2}M${c1}Z${c2}MMMMMMMMMMMMMMM
+${c1}.ZZZZZZZZZZZZZ${c2}MMM${c1}Z${c2}M${c1}ZZZZZZZZZZ${c2}MMMM
+${c1}.ZZZZZZZZZZZ${c2}MMM${c1}7ZZ${c2}MM${c1}ZZZZZZZZZZ7${c2}M
+${c1} ZZZZZZZZZ${c2}MMMM${c1}ZZZZ${c2}MMMM${c1}ZZZZZZZ77
+${c2} MMMMMMMMMMMM${c1}ZZZZZ${c2}MMMM${c1}ZZZZZ77
+${c2} MMMMMMMMMM${c1}7ZZZZZZ${c2}MMMMM${c1}ZZ77
+${c2} .MMMMMMM${c1}ZZZZZZZZ${c2}MMMMM${c1}Z7Z
+${c2} MMMMM${c1}ZZZZZZZZZ${c2}MMMMMMM
+${c1} NZZZZZZZZZZZ${c2}MMMMM
+${c1} ZZZZZZZZZ${c2}MM)
"
diff --git a/neofetch b/neofetch
index aaf8cfb0..bd47d4d2 100755
--- a/neofetch
+++ b/neofetch
@@ -56,6 +56,7 @@ getdistro() {
# Workaround for distros that store the value differently.
[ -z "$distro" ] && distro="$(awk -F 'TAILS_PRODUCT_NAME="|"' '/^TAILS_PRODUCT_NAME=/ {printf $2}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease)"
+ [ -z "$distro" ] && distro="$(awk -F "'" '/^DISTRIB_DESCRIPTION/ {print $2}' /etc/openwrt_release)"
fi
;;
@@ -128,7 +129,7 @@ getdistro() {
# Title {{{
gettitle() {
- title="${USER:-$(whoami)}@${HOSTNAME:-$(hostname)}"
+ title="${USER:-$(whoami || printf "%s" "${HOME/*\/}")}@${HOSTNAME:-$(hostname)}"
}
# }}}
@@ -150,7 +151,7 @@ getuptime() {
case "$os" in
"Linux" | "Windows")
case "$distro" in
- *"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
+ *"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "OpenWRT"* | "Windows"*)
uptime="$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')"
;;
@@ -277,6 +278,9 @@ getpackages() {
type -p apk >/dev/null 2>&1 && \
packages="$((packages+=$(apk info | wc -l)))"
+ type -p opkg >/dev/null 2>&1 && \
+ packages="$((packages+=$(opkg list-installed | wc -l)))"
+
type -p pacman-g2 >/dev/null 2>&1 && \
packages="$((packages+=$(pacman-g2 -Q | wc -l)))"
@@ -572,7 +576,7 @@ getcpu() {
speed="$((speed / 100))"
fi
- cores="$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo)"
+ cores="$(grep -c ^processor /proc/cpuinfo)"
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
@@ -1467,17 +1471,29 @@ gettermfont() {
getdisk() {
# df flags
case "$os" in
- "Linux" | "iPhone OS" | "Windows" | "Solaris") df_flags="-h -l --total" ;;
+ "Linux" | "iPhone OS" | "Windows" | "Solaris")
+ df_flags="-h -l --total"
+ df_dir="total"
+
+ case "$distro" in
+ "OpenWRT"*) df_flags="-h"; df_dir="rootfs" ;;
+ esac
+ ;;
+
"Mac OS X" | "BSD")
case "$distro" in
- "FreeBSD"* | *"OS X"* ) df_flags="-H / -l" ;;
+ "FreeBSD"* | *"OS X"* )
+ df_flags="-l -H /"
+ df_dir="/"
+ ;;
+
*) return ;;
esac
;;
esac
# Get the disk info
- disk="$(df $df_flags 2>/dev/null | awk 'END{print $2 ":" $3 ":" $5}')"
+ disk="$(df $df_flags 2>/dev/null | awk -v dir="$df_dir" '$0 ~ dir {print $2 ":" $3 ":" $5}')"
# Format the output
disk_used="${disk#*:}"
@@ -1868,14 +1884,16 @@ getascii() {
ascii_strip="${ascii_strip//'\\'/ }"
ascii_strip="${ascii_strip//'\'}"
- # Get ascii file size in rows/cols
- ascii_size="$(awk 'END {printf NR " "}length>max{max=length}END{printf max}' <<< "$ascii_strip")"
- lines="${ascii_size/ *}"
- ascii_length="${ascii_size/$lines}"
+ # Get lines/columns of the ascii file in pure bash.
+ ascii_length=0
+ lines=1
+ while IFS='\n' read -r line 2>/dev/null; do
+ [ ${#line} -gt "$ascii_length" ] && ascii_length=${#line}
+ lines=$((lines+=1))
+ done <<< "$ascii_strip"
padding="\033[$((ascii_length + gap))C"
printf "%b%s" "$print"
-
export LC_ALL=C
}
@@ -1901,7 +1919,6 @@ getimage() {
esac
# Get terminal width and height
- stty -echo
if [ -n "$TMUX" ]; then
printf "%b%s" "\033Ptmux;\033\033[14t\033\033[c\033\\"
read_flags="-d c"
@@ -1915,8 +1932,7 @@ getimage() {
fi
# The escape code above prints the output AFTER the prompt so this
- read -t 1 ${read_flags} -s -r term_size
- stty echo
+ builtin read -s -t 1 ${read_flags} -r term_size
# Split the string
if [ "$image_backend" == "tycat" ]; then
@@ -2629,7 +2645,7 @@ kdeconfigdir() {
dynamicprompt() {
# Get cursor position
- info_height="$(stty -echo; IFS=';' read -rdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}"; stty echo)"
+ info_height="$(IFS=';' builtin read -srdR -t 1 -d c -p $'\033[6n\033[c' ROW COL; printf "%s" "${ROW#*[}")"
# Calculate image height in terminal cells.
# The '+ 3' adds a gap between the prompt and the content.