Merge branch 'master' into logosize

This commit is contained in:
Dylan Araps 2016-12-19 16:09:29 +11:00 committed by GitHub
commit fc8e8ce605
2 changed files with 25 additions and 10 deletions

View File

@ -28,6 +28,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques
- This removes a lot of duplicate code between `info()` and `prin()`.
- Remove `printf` subshells and instead use `printf -v` to declare the variables.
- Set fixed `$PATH` in the beginning of the script.
- Fixed artifacts when using line-breaks in TTYs.
## Info
@ -77,14 +78,14 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques
- Rewrote function from scratch.
- The function is `40` lines smaller than before and works on all \[1\] versions of `df` we tested on \[2\].
- We only show the `root (/)` partition now.
- Showing a total of all disks only worked on GNU `df` and we had to hardcode different commands for Distros and Operating Systens that used a different `df`.
- Showing a total of all disks only worked on GNU `df` and we had to hardcode different commands for Distros and Operating Systems that used a different `df`.
- We're using the same `df` flags across all Operating Systems now.
- No more ugly case statements or per distro hardcoding of `df` flags.
- Removed all percentage calculation since `df` already provides us with the percentage.
- Warn the user if `df` isn't installed.
- Fixed broken output if `df` wasn't installed but the function was enabled.
\[1\] The function doesn't work on Haiku since their `df` is wildly non-standard. (The output format and flags are 100% different from all of the other `df` versions floating around.)
\[1\] The function doesn't work on Haiku since their `df` is wildly non-standard. (The output format and flags are 100% different from all of the other `df` versions floating around.)
\[2\] Tested on `GNU`, `Busybox`, `BSD`, `Solaris` and `macOS` `df` versions.
@ -107,11 +108,14 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques
**Color Blocks**<br \>
- Use start++ instead of adding it manually after case. **[@konimex](https://github.com/konimex)**
- Fixed bug where color blocks wouldn't respect width in TTYs.
- Cursor positioning now takes `$block_height` into account.
## Images
- [iTerm2] Fixed blank images.
- Fixed bug where image mode would attempt to run in a TTY.
## Ascii

View File

@ -1738,7 +1738,6 @@ get_cols() {
if [[ "$color_blocks" == "on" ]]; then
# Convert the width to space chars.
printf -v block_width "%${block_width}s"
block_width="${block_width// /█}"
# Generate the string.
for ((start; start<=end; start++)); do
@ -1759,9 +1758,12 @@ get_cols() {
# Add newlines to the string.
cols="${cols%%'nl'}"
cols="${cols//nl/\\n\\033[${text_padding}C${zws}}"
printf "%b\n" "\033[${text_padding}C${zws}${cols}"
info_height="$((info_height+=block_height+2))"
fi
unset blocks blocks2
unset -v blocks blocks2 cols
}
# IMAGES
@ -1769,10 +1771,18 @@ get_cols() {
get_image_backend() {
# This function determines which image backend to use
# by checking for programs and etc.
get_image_program
# Fallback to ascii mode if imagemagick isn't installed.
type -p convert >/dev/null 2>&1 || image_backend="ascii"
# If the image source isn't 'ascii' or 'off'
if [[ ! "${image_source}" =~ ^(off|ascii)$ ]]; then
# If X isn't running force ascii mode here.
[[ -z "$DISPLAY" ]] && image_source="ascii"
# Fallback to ascii mode if imagemagick isn't installed.
type -p convert >/dev/null 2>&1 || image_source="ascii"
fi
# Get the image program.
get_image_program
# If image source is ascii fallback to ascii
if [[ "$image_source" == "ascii" ]]; then
@ -2359,7 +2369,8 @@ get_underline() {
}
get_line_break() {
line_break=" "
# Print it directly.
printf "%s\n" "${zws} "
# Calculate info height
info_height="$((info_height+=1))"
@ -3130,8 +3141,8 @@ exit 1
}
get_args() {
# Check the command-line flags early for '--config none/off'
[[ "$@" =~ --config\ ?(off|none) ]] || get_user_config 2>/dev/null
# Check the commandline flags early for '--config'
[[ "$@" =~ --config ]] || get_user_config 2>/dev/null
while [[ "$1" ]]; do
case "$1" in