Compare commits

..

1 Commits

Author SHA1 Message Date
Dylan Araps
a5405baec6 packages: start work on bedrock support 2019-01-04 21:20:14 +02:00
4 changed files with 133 additions and 389 deletions

View File

@@ -18,6 +18,6 @@ install:
script:
- time ./neofetch --travis -v
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck -e SC2244 -e SC2243 neofetch; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch; fi
# Check for lines longer than 100 chars.
- if grep '.\{102\}' neofetch; then (exit 1); else (exit 0); fi

View File

@@ -7,106 +7,37 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
<img src="https://i.imgur.com/ZQI2EYz.png" alt="logo" height="100px">
**Contributors**
[**@konimex**](https://github.com/konimex), [**@iandrewt**](https://github.com/iandrewt), [**@arisinfenix**](https://github.com/arisinfenix), [**@xPMo**](https://github.com/xPMo), [**@nero**](https://github.com/nero), [**@alyssais**](https://github.com/alyssais), [**@plgruener**](https://github.com/plgruener), [**@StarryTony**](https://github.com/StarryTony), [**@julianaito**](https://github.com/julianaito), [**@HolyStephano**](https://github.com/HolyStephano), [**@nikitenich**](https://github.com/nikitenich), [**@Appadeia**](https://github.com/Appadeia), [**@marlonn**](https://github.com/marlonn), [**@Snuggle**](https://github.com/dylanaraps/neofetch/commits?author=Snuggle), [**@Phuurl**](https://github.com/Phuurl), [**@erikdubois**](https://github.com/erikdubois)
**OS**
- Added support for Bedrock Linux. [**@paradigm**](https://github.com/paradigm)
- Added support for Namib GNU/Linux. [**@arisinfenix**](https://github.com/arisinfenix)
- Added support for Reborn OS. [**@iandrewt**](https://github.com/iandrewt)
- Added support for OpenMandriva Lx. [**@konimex**](https://github.com/konimex)
- Added support for Star. [**@arisinfenix**](https://github.com/arisinfenix)
- Added support for BlueLight OS.
- Added support for Huayra Linux.
- Added support for Pentoo.
**Highlights**
- [ASCII] Added support for command output. You can now use whatever terminal commands you like as the ASCII art.
```sh
# Use fortune and cowsay as ascii art.
neofetch --ascii "$(fortune|cowsay -W 30)"
# use figlet as ascii art.
neofetch --ascii "$(figlet -w 30 hello world)"
```
<img src="https://i.imgur.com/ozoXAvz.jpg" alt="scrot" height="400px">
- Added a new "simple" mode. You can now use neofetch for scripting by getting it to output individual info functions in plain text.
```sh
# Example:
neofetch uptime --uptime_shorthand tiny
> uptime: 32m
# Example:
neofetch uptime disk wm memory
> uptime: 33 mins
> disk (/): 212G / 235G (96%)
> wm: Openbox
> memory: 1215MiB / 7881MiB
# This can be used in bars and scripts like so:
memory="$(neofetch memory)"; memory="${memory##*: }"
# For multiple outputs at once (each line of info in an array):
# Much faster than running neofetch multiple times.
IFS=$'\n' read -d "" -ra info < <(neofetch memory uptime wm)
info=("${info[@]##*: }")
```
- [**@nero**](https://github.com/nero)
- [**@alyssais**](https://github.com/alyssais)
- [**@plgruener**](https://github.com/plgruener)
- [**@StarryTony**](https://github.com/StarryTony)
- [**@julianaito**](https://github.com/julianaito)
- [**@HolyStephano**](https://github.com/HolyStephano)
- [**@nikitenich**](https://github.com/nikitenich)
**Info**
- **Song**: Added snippet to display music player.
- `[[ $player ]] && prin "Music Player" "$player"`
- NOTE: Must have `info "Song" song` enabled.
- **Song**: Added support for Netease Cloud.
- **Song**: Fixed issues in various players. [**@arisinfenix**](https://github.com/arisinfenix) [**@xPMo**](https://github.com/xPMo)
- **Song**: Fixed issues with non-English tags.
- **Song**: Fixed issues with broken newlines.
- **Song**: Fixed issues with Deadbeef.
- **Song**: Fixed issues with `qmmp`.
- **Song**: Removed `gpmdp-remote` support (unmaintained/no longer works).
- **Shell**: Fixed output for mksh [**@nero**](https://github.com/nero)
- **Packages**: Added support for `scoop`. [**@Phuurl**](https://github.com/Phuurl)
- **Packages**: Added support for `puyo`. [**@Appadeia**](https://github.com/Appadeia)
- **Packages**: Added support for `spm`. [**@Appadeia**](https://github.com/author=Appadeia)
- **Packages** [macOS]: Added detection of Nix [**@alyssais**](https://github.com/alyssais)
- **Packages**: Fixed packages from pkginfo (pkgutils) not appearing in CRUX/Janus Linux.
- **Terminal Font**: Added support for Yakuake [**@plgruener**](https://github.com/plgruener)
- **Terminal Font** [Kitty]: Use `kitty --debug-config` to get font information.
- **Memory** [Solaris]: Updated memory detection to use pages. [**@konimex**](https://github.com/konimex)
- **Model** [OpenBSD]: Added vmm (OpenBSD hypervisor) support [**@julianaito**](https://github.com/julianaito)
- **Model** [macOS]: Added VirtualSMC as a new FakeSMC alternative for Hackintosh. [**@nikitenich**](https://github.com/nikitenich)
- **WM**: Added detection for FVWM. [**@julianaito**](https://github.com/julianaito)
- **WM** [OpenBSD]: Added a new `ps_flags` to correctly detect non-EWMH WMs. [**@julianaito**](https://github.com/julianaito)
- **Disk** [OpenBSD]: Added a separate disk array creation using `awk` since one cannot directly use `/dev/...` unless being root or in the `operator` group. [**@julianaito**](https://github.com/julianaito)
- **Battery** [OpenBSD]: Improve charge `%` and add status. **Charlène**
- **GPU** [AMD]: Remove unnecessary check.
**ASCII**
- Added support for command output.
- `neofetch --ascii "$(fortune|cowsay -W 30)"`
- `neofetch --ascii "$(figlet -w 30 hello world)"`
- Added small ArcoLinux logo. [**@erikdubois**](https://github.com/erikdubois)
- Added new Lubuntu logo. [**@marlonn**](https://github.com/marlonn)
- Fixed a bug where ASCII logo changes the terminal foreground color. [**@plgruener**](https://github.com/plgruener)
- Fixed a bug when files named `auto` or `ascii` exist.
- Do not parse file as ASCII if the source is an image file.
**Image**
- **macOS**: Unset IFS to get window size. [**@StarryTony**](https://github.com/StarryTony)
- **Kitty**: Use `kitty +kitten icat` instead of the deprecated `kitty icat`. [**@HolyStephano**](https://github.com/HolyStephano)
- **Kitty**: Update docs. [**@Snuggle**](https://github.com/dylanaraps/neofetch/commits?author=Snuggle)
- Cached thumbnails are now stored with PATH to prevent collision issues.
## [5.0.0] - 2018-06-18

396
neofetch
View File

@@ -28,7 +28,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
version="6.0.0"
version="5.0.1"
bash_version="${BASH_VERSION/.*}"
sys_locale="${LANG:-C}"
@@ -76,13 +76,14 @@ print_info() {
# info "Battery" battery
# info "Font" font
# info "Song" song
# [[ $player ]] && prin "Music Player" "$player"
# info "Local IP" local_ip
# info "Public IP" public_ip
# info "Users" users
# info "Locale" locale # This only works on glibc systems.
info line_break
info cols
info line_break
}
@@ -142,21 +143,6 @@ os_arch="on"
uptime_shorthand="on"
# Memory
# Show memory pecentage in output.
#
# Default: 'off'
# Values: 'on', 'off'
# Flag: --memory_percent
#
# Example:
# on: '1801MiB / 7881MiB (22%)'
# off: '1801MiB / 7881MiB'
memory_percent="off"
# Packages
@@ -375,12 +361,6 @@ gtk3="on"
# Flag: --ip_host
public_ip_host="http://ident.me"
# Public IP timeout.
#
# Default: '2'
# Values: 'int'
# Flag: --ip_timeout
public_ip_timeout=2
# Disk
@@ -449,6 +429,7 @@ disk_subtitle="mount"
# exaile
# gnome-music
# gmusicbrowser
# Google Play
# guayadeque
# iTunes
# juk
@@ -456,7 +437,6 @@ disk_subtitle="mount"
# mocp
# mopidy
# mpd
# netease-cloud-music
# pogo
# pragha
# qmmp
@@ -669,8 +649,7 @@ disk_display="off"
# Image backend.
#
# Default: 'ascii'
# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off',
# 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty'
# Values: 'ascii', 'caca', 'jp2a', 'iterm2', 'off', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty'
# Flag: --backend
image_backend="ascii"
@@ -680,7 +659,6 @@ image_backend="ascii"
#
# Default: 'auto'
# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/'
# 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")'
# Flag: --source
#
# NOTE: 'auto' will pick the best image source for whatever image backend is used.
@@ -849,12 +827,7 @@ get_distro() {
case "$os" in
"Linux" | "BSD" | "MINIX")
if [[ -f /bedrock/etc/bedrock-release && $PATH == */bedrock/cross/* ]]; then
case "$distro_shorthand" in
"on" | "tiny") distro="Bedrock Linux" ;;
*) distro="$(< /bedrock/etc/bedrock-release)"
esac
elif [[ -f "/etc/redstar-release" ]]; then
if [[ -f "/etc/redstar-release" ]]; then
case "$distro_shorthand" in
"on" | "tiny") distro="Red Star OS" ;;
*) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)"
@@ -925,6 +898,11 @@ get_distro() {
"tiny") distro="${NAME:-${DISTRIB_ID:-${TAILS_PRODUCT_NAME}}}" ;;
"off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;;
esac
# Workarounds for distros that go against the os-release standard.
[[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}')" "${files[@]}"
[[ -z "${distro// }" ]] && distro="$(awk -F'=' '{print $2; exit}')" "${files[@]}"
else
for release_file in /etc/*-release; do
distro+="$(< "$release_file")"
@@ -1292,15 +1270,11 @@ get_packages() {
pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; }
tot() { IFS=$'\n' read -d "" -ra pkgs < <("$@");((packages+="${#pkgs[@]}"));pac "${#pkgs[@]}"; }
# Redefine tot() for Bedrock Linux.
[[ -f /bedrock/etc/bedrock-release && $PATH == */bedrock/cross/* ]] && {
[[ -f "/bedrock/etc/bedrock-release" && "$PATH" == */bedrock/cross/* ]] && \
tot() {
IFS=$'\n' read -d "" -ra pkgs < <(for s in $(brl list); do strat -r "$s" "$@"; done)
((packages+="${#pkgs[@]}"))
pac "${#pkgs[@]}"
IFS=$'\n' read -d "" -ra pkgs < <(for s in $(brl list); do strat -r "${s}" "$@"; done)
((packages+="${#pkgs[@]}")); pac "${#pkgs[@]}"
}
br_prefix="/bedrock/strata/*"
}
case "$os" in
"Linux" | "BSD" | "iPhone OS" | "Solaris")
@@ -1319,30 +1293,22 @@ get_packages() {
has "sorcery" && tot gaze installed
has "alps" && tot alps showinstalled
has "butch" && tot butch list
has "pkginfo" && tot pkginfo -i
# Counting files/dirs.
# Variables need to be unquoted here. Only Bedrock Linux is affected.
# $br_prefix is fixed and won't change based on user input so this is safe either way.
# shellcheck disable=SC2086
{
has "emerge" && dir ${br_prefix}/var/db/pkg/*/*/
has "nix-env" && dir ${br_prefix}/nix/store/*/
has "guix" && dir ${br_prefix}/gnu/store/*/
has "Compile" && dir ${br_prefix}/Programs/*/
has "eopkg" && dir ${br_prefix}/var/lib/eopkg/package/*
has "crew" && dir ${br_prefix}/usr/local/etc/crew/meta/*.filelist
has "pkgtool" && dir ${br_prefix}/var/log/packages/*
has "cave" && dir ${br_prefix}/var/db/paludis/repositories/cross-installed/*/data/*/ \
${br_prefix}/var/db/paludis/repositories/installed/data/*/
}
has "emerge" && dir /var/db/pkg/*/*/
has "nix-env" && dir /nix/store/*/
has "guix" && dir /gnu/store/*/
has "Compile" && dir /Programs/*/
has "eopkg" && dir /var/lib/eopkg/package/*
has "crew" && dir /usr/local/etc/crew/meta/*.filelist
has "pkgtool" && dir /var/log/packages/*
has "cave" && dir /var/db/paludis/repositories/cross-installed/*/data/*/ \
/var/db/paludis/repositories/installed/data/*/
# Other (Needs complex command)
has "kpm-pkg" && ((packages+="$(kpm --get-selections | grep -cv deinstall$)"))
# pkginfo is also the name of a python package manager which is painfully slow.
# TODO: Fix this somehow.
has pkginfo && tot pkginfo -i
case "$kernel_name" in
"FreeBSD") has "pkg" && tot pkg info ;;
*)
@@ -1381,9 +1347,6 @@ get_packages() {
"MSYS"*) has "pacman" && tot pacman -Qq --color never ;;
esac
# Scoop environment throws errors if `tot scoop list` is used
has "scoop" && dir ~/scoop/apps/* && ((packages-=1))
# Count chocolatey packages.
[[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \
dir /cygdrive/c/ProgramData/chocolatey/lib/*
@@ -2313,8 +2276,8 @@ get_memory() {
"Solaris")
hw_pagesize="$(pagesize)"
pages_total="$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')"
pages_free="$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')"
pages_total=$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')
pages_free=$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')
mem_total="$((pages_total * hw_pagesize / 1024 / 1024))"
mem_free="$((pages_free * hw_pagesize / 1024 / 1024))"
mem_used="$((mem_total - mem_free))"
@@ -2354,10 +2317,7 @@ get_memory() {
;;
esac
[[ $memory_percent == on ]] && ((mem_perc=mem_used * 100 / mem_total))
memory="${mem_used}${mem_label:-MiB} / ${mem_total}${mem_label:-MiB} ${mem_perc:+(${mem_perc}%)}"
memory="${mem_used}${mem_label:-MiB} / ${mem_total}${mem_label:-MiB}"
# Bars.
case "$memory_display" in
@@ -2382,6 +2342,7 @@ get_song() {
"exaile"
"gnome-music"
"gmusicbrowser"
"Google Play"
"guayadeque"
"iTunes"
"juk"
@@ -2389,7 +2350,6 @@ get_song() {
"mocp"
"mopidy"
"mpd"
"netease-cloud-music"
"pogo"
"pragha"
"qmmp"
@@ -2427,9 +2387,10 @@ get_song() {
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%')" ;;
"google play"*) song="$(gpmdp-remote current)" ;;
"deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist%\n%album%\n%title%')" ;;
"xmms2d"*) song="$(xmms2 current -f "\${artist}"$'\n'"\${album}"$'\n'"\${title}")" ;;
"qmmp"*) song="$(qmmp --nowplaying '%p\\n%a\\n%t')" ;;
"qmmp"*) song="$(qmmp --nowplaying '%p\n%a\n%t')" ;;
"gnome-music"*) get_song_dbus "GnomeMusic" ;;
"lollypop"*) get_song_dbus "Lollypop" ;;
"clementine"*) get_song_dbus "clementine" ;;
@@ -2449,7 +2410,6 @@ get_song() {
"dragon"*) get_song_dbus "dragonplayer" ;;
"smplayer"*) get_song_dbus "smplayer" ;;
"rhythmbox"*) get_song_dbus "rhythmbox" ;;
"netease-cloud-music"*) get_song_dbus "netease-cloud-music" ;;
"cmus"*)
song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "};
@@ -2510,28 +2470,22 @@ get_song() {
/"title"/ {t=$4} END {print a "\n" b "\n" t}')"
;;
*) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" || return ;;
*) mpc &>/dev/null && song="$(mpc -f '%artist%\n%album%\n%title%' current)" ;;
esac
IFS=$'\n' read -d "" -r artist album title <<< "${song//'\n'/$'\n'}"
[[ "$song" != *[a-z]* ]] && { unset -v song; return; }
# Make sure empty tags are truly empty.
artist="$(trim "$artist")"
album="$(trim "$album")"
title="$(trim "$title")"
# Set default values if no tags were found.
: "${artist:=Unknown Artist}" "${album:=Unknown Album}" "${title:=Unknown Song}"
IFS=$'\n' read -d "" -r artist album title <<< "$song"
# Display Artist, Album and Title on separate lines.
if [[ "$song_shorthand" == "on" ]]; then
prin "Artist" "$artist"
prin "Album" "$album"
prin "Song" "$title"
[[ "$(trim "$artist")" ]] && prin "Artist" "$artist"
[[ "$(trim "$album")" ]] && prin "Album" "$album"
[[ "$(trim "$song")" ]] && prin "Song" "$title"
else
song="${song_format/\%artist\%/$artist}"
song="${song/\%album\%/$album}"
song="${song/\%title\%/$title}"
song="${song_format/\%artist\%/${artist}}"
song="${song/\%album\%/${album}}"
song="${song/\%title\%/${title}}"
fi
}
@@ -2618,7 +2572,6 @@ get_resolution() {
esac
resolution="${resolution%,*}"
[[ -z ${resolution/x} ]] && resolution=
}
get_style() {
@@ -2920,11 +2873,21 @@ END
;;
"kitty"*)
kitty_config="$(kitty --debug-config)"
term_font_size="${kitty_config/*font_size}"
term_font_size="${term_font_size/$'\n'*}"
term_font="${kitty_config/*font_family}"
term_font="${term_font/$'\n'*} $term_font_size"
shopt -s nullglob
confs=({$KITTY_CONFIG_DIRECTORY,$XDG_CONFIG_HOME,~/Library/Preferences}/kitty/kitty.con?)
shopt -u nullglob
[[ -f "${confs[0]}" ]] || return
term_font="$(awk '/^([[:space:]]*|[^#_])font_family[[:space:]]+/ {
$1 = "";
gsub(/^[[:space:]]/, "");
font = $0
}
/^([[:space:]]*|[^#_])font_size[[:space:]]+/ {
size = $2
}
END {print font,size}' "${confs[0]}")"
;;
"konsole" | "yakuake")
@@ -3315,11 +3278,11 @@ get_public_ip() {
fi
if [[ -z "$public_ip" ]] && type -p curl >/dev/null; then
public_ip="$(curl --max-time "$public_ip_timeout" -w '\n' "$public_ip_host")"
public_ip="$(curl --max-time 10 -w '\n' "$public_ip_host")"
fi
if [[ -z "$public_ip" ]] && type -p wget >/dev/null; then
public_ip="$(wget -T "$public_ip_timeout" -qO- "$public_ip_host")"
public_ip="$(wget -T 10 -qO- "$public_ip_host")"
fi
}
@@ -3345,7 +3308,6 @@ get_gpu_driver() {
gpu_driver="NVIDIA ${gpu_driver/ *}"
fi
;;
"Mac OS X")
if [[ "$(kextstat | grep "GeForceWeb")" != "" ]]; then
gpu_driver="NVIDIA Web Driver"
@@ -3388,9 +3350,9 @@ get_cols() {
cols="${cols//nl/\\n\\e[${text_padding}C${zws}}"
# Add block height to info height.
((info_height+=block_range[1]>7?block_height+3:block_height+2))
((info_height+=block_height-1))
printf '\n\e[%bC%b\n\n' "$text_padding" "${zws}${cols}"
printf '\e[%bC%b' "$text_padding" "${zws}${cols}"
fi
unset -v blocks blocks2 cols
@@ -3413,7 +3375,7 @@ image_backend() {
"ascii") get_ascii ;;
"off") image_backend="off" ;;
"caca" | "chafa" | "jp2a" | "iterm2" | "termpix" |\
"caca" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm" | "kitty")
get_image_source
@@ -3438,7 +3400,7 @@ image_backend() {
*)
err "Image: Unknown image backend specified '$image_backend'."
err "Image: Valid backends are: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'kitty',
err "Image: Valid backends are: 'ascii', 'caca', 'jp2a', 'iterm2', 'kitty',
'off', 'sixel', 'pixterm', 'termpix', 'tycat', 'w3m')"
err "Image: Falling back to ascii mode."
get_ascii
@@ -3450,25 +3412,20 @@ image_backend() {
}
get_ascii() {
[[ ! "$image_source" =~ (ascii|auto) ]] &&
if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then
ascii_data="$(< "$image_source")"
else
ascii_data="$image_source"
fi
if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then
ascii_data="$(< "$image_source")"
else
err "Ascii: Ascii file not found, using distro ascii."
fi
# Set locale to get correct padding.
LC_ALL="$sys_locale"
# Calculate size of ascii file in line length / line count.
while IFS=$'\n' read -r line; do
line="${line//\\\\/\\}"
((++lines,${#line}>ascii_len)) && ascii_len="${#line}"
((++lines,${#line}>ascii_length)) && ascii_length="${#line}"
done <<< "${ascii_data//\$\{??\}}"
# Fallback if file not found.
((lines==1)) && { lines=; ascii_len=; image_source="auto"; get_distro_ascii; get_ascii; return; }
# Colors.
ascii_data="${ascii_data//\$\{c1\}/$c1}"
ascii_data="${ascii_data//\$\{c2\}/$c2}"
@@ -3477,7 +3434,7 @@ get_ascii() {
ascii_data="${ascii_data//\$\{c5\}/$c5}"
ascii_data="${ascii_data//\$\{c6\}/$c6}"
((text_padding=ascii_len+gap))
((text_padding=ascii_length+gap))
printf '%b\n' "$ascii_data${reset}"
LC_ALL=C
}
@@ -3726,18 +3683,15 @@ get_image_size() {
*) image_size="${image_size/px}" ;;
esac
# Check for terminal padding.
[[ $image_backend == w3m ]] && term_padding
width="${width:-$image_size}"
height="${height:-$image_size}"
text_padding="$(((width + padding + xoffset) / font_width + gap))"
text_padding="$((width / font_width + gap + xoffset/font_width))"
}
make_thumbnail() {
# Name the thumbnail using variables so we can
# use it later.
image_name="${crop_mode}-${crop_offset}-${width}-${height}-${image//\/}"
image_name="${crop_mode}-${crop_offset}-${width}-${height}-${image##*/}"
# Handle file extensions.
case "${image##*.}" in
@@ -3792,9 +3746,11 @@ make_thumbnail() {
-background none \
"$image" \
-strip \
-define "jpeg:size=100x100" \
-gravity "$crop_offset" \
-crop "${size}x${size}+0+0" \
-scale "${width}x${height}" \
-quality 40 \
-sample "${width}x${height}" \
"${thumbnail_dir}/${image_name}"
;;
esac
@@ -3808,21 +3764,17 @@ display_image() {
case "$image_backend" in
"caca")
img2txt \
-W "$((width / font_width))" \
-W "$((width / font_width)))" \
-H "$((height / font_height))" \
--gamma=0.6 \
"$image"
;;
"chafa")
chafa --size="$((width / font_width))x$((height / font_height))" "$image"
;;
"jp2a")
jp2a \
--colors \
--width="$((width / font_width))" \
--height="$((height / font_height))" \
--colors \
"$image"
;;
@@ -3876,7 +3828,7 @@ display_image() {
# Add a tiny delay to fix issues with images not
# appearing in specific terminal emulators.
((BASH_VERSINFO[0]>3)) && sleep 0.05
sleep 0.05
printf '%b\n%s;\n%s\n' "0;1;$xoffset;$yoffset;$width;$height;;;;;$image" 3 4 |\
"${w3m_img_path:-false}" -bg "$background_color" &>/dev/null
;;
@@ -3953,7 +3905,7 @@ prin() {
string="${subtitle_color}${bold}${string}"
# Print the info.
printf '%b\n' "${text_padding:+\e[${text_padding}C}${zws}${string//\\n}${reset} "
printf '%b\n' "${text_padding:+\e[${text_padding}C}${zws}${string}${reset} "
# Calculate info height.
((++info_height))
@@ -3974,6 +3926,17 @@ get_underline() {
prin=1
}
get_line_break() {
# Print it directly.
printf '%b\n' "$zws"
# Calculate info height.
((++info_height))
# Tell info() that we printed manually.
prin=1
}
get_bold() {
case "$ascii_bold" in
"on") ascii_bold='\e[1m' ;;
@@ -4073,9 +4036,18 @@ color() {
stdout() {
image_backend="off"
unset subtitle_color colon_color info_color underline_color bold title_color at_color \
text_padding zws reset color_blocks bar_color_elapsed bar_color_total \
c1 c2 c3 c4 c5 c6 c7 c8
unset subtitle_color
unset colon_color
unset info_color
unset underline_color
unset bold
unset title_color
unset at_color
unset text_padding
unset zws
unset reset
unset color_blocks
unset get_line_break
}
err() {
@@ -4194,23 +4166,9 @@ kde_config_dir() {
kde_config_dir="${kde_config_dir/$'/:'*}"
}
term_padding() {
# Get terminal padding to properly align cursor.
[[ -z $term ]] && get_term
case "$term" in
urxvt*|"rxvt-unicode")
[[ -z "$xrdb" ]] && xrdb="$(xrdb -query)"
padding="${xrdb/*.internalBorder:}"
((padding=${padding/$'\n'*}))
;;
esac
}
dynamic_prompt() {
[[ $image_backend == off ]] && { printf '\n'; return; }
[[ $image_backend != ascii ]] && ((lines=(height + yoffset) / font_height + 1))
[[ $image_backend == w3m ]] && ((lines=lines + padding / font_height + 1))
[[ "$image_backend" == "off" ]] && { printf '\n'; return; }
[[ "$image_backend" != "ascii" ]] && lines="$(((height + yoffset) / font_height + 1))"
# If the ascii art is taller than the info.
((lines=lines>info_height?lines-info_height+1:1))
@@ -4287,7 +4245,7 @@ decode_url() {
# FINISH UP
usage() { printf "%s" "\
Usage: neofetch func_name --option \"value\" --option \"value\"
Usage: neofetch --option \"value\" --option \"value\"
Neofetch is a CLI system information tool written in BASH. Neofetch
displays information about your system next to an image, your OS logo,
@@ -4298,23 +4256,6 @@ NOTE: Every launch flag has a config option.
Options:
INFO:
func_name Specify a function name (second part of info() from config) to
quickly display only that function's information.
Example: neofetch uptime --uptime_shorthand tiny
Example: neofetch uptime disk wm memory
This can be used in bars and scripts like so:
memory=\"\$(neofetch memory)\"; memory=\"\${memory##*: }\"
For multiple outputs at once (each line of info in an array):
IFS=\$'\\n' read -d \"\" -ra info < <(neofetch memory uptime wm)
info=(\"\${info[@]##*: }\")
--disable infoname Allows you to disable an info line from appearing
in the output. 'infoname' is the function name from the
'print_info()' function inside the config file.
@@ -4385,10 +4326,8 @@ INFO:
'dir' shows the basename of the disks's path. (/, Local Disk, etc)
--ip_host url URL to query for public IP
--ip_timeout int Public IP timeout (in seconds).
--song_format format Print the song data in a specific format (see config file).
--song_shorthand on/off Print the Artist/Album/Title on separate lines.
--memory_percent on/off Display memory percentage.
--music_player player-name Manually specify a player to use.
Available values are listed in the config file
@@ -4424,18 +4363,13 @@ BARS:
IMAGE BACKEND:
--backend backend Which image backend to use.
Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2',
'off', 'sixel', 'tycat', 'w3m'
Possible values: 'ascii', 'caca', 'jp2a', 'iterm2', 'off',
'sixel', 'tycat', 'w3m'
--source source Which image or ascii file to use.
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img',
'/path/to/ascii', '/path/to/dir/', 'command output' [ascii]
'/path/to/ascii', '/path/to/dir/'
--ascii source Shortcut to use 'ascii' backend.
NEW: neofetch --ascii \"\$(fortune | cowsay -W 30)\"
--caca source Shortcut to use 'caca' backend.
--chafa source Shortcut to use 'chafa' backend.
--iterm2 source Shortcut to use 'iterm2' backend.
--jp2a source Shortcut to use 'jp2a' backend.
--kitty source Shortcut to use 'kitty' backend.
@@ -4540,11 +4474,9 @@ get_args() {
"--shell_path") shell_path="$2" ;;
"--shell_version") shell_version="$2" ;;
"--ip_host") public_ip_host="$2" ;;
"--ip_timeout") public_ip_timeout="$2" ;;
"--song_format") song_format="$2" ;;
"--song_shorthand") song_shorthand="$2" ;;
"--music_player") music_player="$2" ;;
"--memory_percent") memory_percent="$2" ;;
"--cpu_temp")
cpu_temp="$2"
[[ "$cpu_temp" == "on" ]] && cpu_temp="C"
@@ -4620,7 +4552,7 @@ get_args() {
# Image backend
"--backend") image_backend="$2" ;;
"--source") image_source="$2" ;;
"--ascii" | "--caca" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--ascii" | "--caca" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty")
image_backend="${1/--}"
case "$2" in
@@ -4659,12 +4591,13 @@ get_args() {
"--ascii_distro")
image_backend="ascii"
ascii_distro="$2"
case "$2" in "-"* | "") ascii_distro="$distro" ;; esac
;;
"--ascii_bold") ascii_bold="$2" ;;
"--logo" | "-L")
image_backend="ascii"
print_info() { printf '\n'; }
print_info() { info line_break; }
;;
# Other
@@ -4694,7 +4627,7 @@ get_args() {
"--json")
json="on"
unset -f get_title get_cols get_underline
unset -f get_title get_cols get_line_break get_underline
printf '{\n'
print_info 2>/dev/null
@@ -4736,7 +4669,9 @@ get_args() {
info "Public IP" public_ip
info "Users" users
info line_break
info cols
info line_break
# Testing.
prin "prin"
@@ -4764,24 +4699,6 @@ get_args() {
done
}
get_simple() {
while [[ "$1" ]]; do
[[ $(type -t "get_$1") == function ]] && {
get_distro
stdout
simple=1
info "$1" "$1"
}
shift
done
((simple)) && exit
}
old_functions() {
# Removed functions for backwards compatability.
get_line_break() { :; }
}
get_distro_ascii() {
# This function gets the distro ascii art and colors.
#
@@ -5280,29 +5197,6 @@ ${c1}:syyyyyy/ :yyyyyy/${c2}-yyo.:syyyyyyyyyyy
EOF
;;
"Bedrock"*)
set_colors 8 7
read -rd '' ascii_data <<'EOF'
${c1}--------------------------------------
--------------------------------------
--------------------------------------
---${c2}\\\\\\\\\\\\\\\\\\\\\\\\${c1}-----------------------
----${c2}\\\\\\ \\\\\\${c1}----------------------
-----${c2}\\\\\\ \\\\\\${c1}---------------------
------${c2}\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\${c1}------
-------${c2}\\\\\\ \\\\\\${c1}-----
--------${c2}\\\\\\ \\\\\\${c1}----
---------${c2}\\\\\\ ______ \\\\\\${c1}---
----------${c2}\\\\\\ ///${c1}---
-----------${c2}\\\\\\ ///${c1}----
------------${c2}\\\\\\ ///${c1}-----
-------------${c2}\\\\\\////////////////${c1}------
--------------------------------------
--------------------------------------
--------------------------------------
EOF
;;
"Bitrig"*)
set_colors 2 7
read -rd '' ascii_data <<'EOF'
@@ -5738,7 +5632,7 @@ EOF
"debian_small")
set_colors 1 7 3
read -rd '' ascii_data <<'EOF'
${c1} _____
${c1}_____
/ __ \\
| / |
| \\___-
@@ -6174,33 +6068,6 @@ yM${c2}MNNNNNNNmmmmmNNMmhs+/${c1}-`
EOF
;;
"Pentoo"*)
set_colors 5 7
read -rd '' ascii_data <<'EOF'
${c2} `:oydNNMMMMNNdyo:`
:yNMMMMMMMMMMMMMMMMNy:
:dMMMMMMMMMMMMMMMMMMMMMMd:
oMMMMMMMho/-....-/ohMMMMMMMo
oMMMMMMy. .yMMMMMMo
.MMMMMMo oMMMMMM.
+MMMMMm mMMMMM+
oMMMMMh hMMMMMo
//hMMMMMm//${c1}`${c2} ${c1}`${c2}////mMMMMMh//
MMMMMMMMMMM${c1}/${c2} ${c1}/o/`${c2} ${c1}.${c2}smMMMMMMMMMMM
MMMMMMMMMMm ${c1}`NMN:${c2} ${c1}.${c2}yMMMMMMMMMM
MMMMMMMMMMMh${c1}:.${c2} dMMMMMMMMM
MMMMMMMMMMMMMy${c1}.${c2} ${c1}-${c2}NMMMMMMMMM
MMMMMMMMMMMd:${c1}`${c2} ${c1}-${c2}yNMMMMMMMMMM
MMMMMMMMMMh${c1}`${c2} ${c1}./${c2}hNMMMMMMMMMMMM
MMMMMMMMMM${c1}s${c2} ${c1}.:${c2}ymMMMMMMMMMMMMMMM
MMMMMMMMMMN${c1}s:..-/${c2}ohNMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
EOF
;;
"gNewSense"*)
set_colors 4 5 7 6
read -rd '' ascii_data <<'EOF'
@@ -6246,8 +6113,8 @@ EOF
"GoboLinux"*)
set_colors 5 4 6 2
read -rd '' ascii_data <<'EOF'
${c1} _____ _
/ ____| | |
${c1}_____ _
/ ____| | |
| | __ ___ | |__ ___
| | |_ |/ _ \| '_ \ / _ \
| |__| | (_) | |_) | (_) |
@@ -6318,29 +6185,6 @@ ${c2} :dc'
EOF
;;
"Huayra"*)
set_colors 4 7
read -rd '' ascii_data <<'EOF'
${c2} `
. . `
`` - . .
`.` -` `. - `` .`
..`-`-` + - / .` ```
.--.+--`+:- :/.` .-``.`
-+/so::h:.d-`./:`.`
:hNhyMomy:os-...-. ````
.dhsshNmNhoo+:-``.```
${c1}`ohy:-${c2}NMds+::-.``
````${c1}.hNN+`${c2}mMNho/:-....````
````` `../dmNhoo+/:..``
```` .dh++o/:....`
.+s/` `/s-.-.:.`` ````
::` `::`..`
.` `..
``
EOF
;;
"Hyperbola"*)
set_colors 8
read -rd '' ascii_data <<'EOF'
@@ -8522,12 +8366,12 @@ EOF
set_colors 2 8
read -rd '' ascii_data <<'EOF'
${c1} _______
_ \\______ -
| \\ ___ \\ |
_ \______ -
| \ ___ \ |
| | / \ | |
| | \___/ | |
| \\______ \\_|
-_______\\
| \______ \_|
-_______\
EOF
;;
@@ -8802,7 +8646,6 @@ main() {
eval "$config"
get_args "$@"
get_simple "$@"
[[ "$verbose" != "on" ]] && exec 2>/dev/null
get_distro
get_bold
@@ -8820,7 +8663,6 @@ main() {
image_backend
get_cache_dir
old_functions
print_info
dynamic_prompt

View File

@@ -1,10 +1,10 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8.
.TH NEOFETCH "1" "January 2019" "Neofetch 6.0.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.7.
.TH NEOFETCH "1" "October 2018" "Neofetch 5.0.1" "User Commands"
.SH NAME
Neofetch \- A fast, highly customizable system info script
.SH SYNOPSIS
.B neofetch
\fI\,func_name --option "value" --option "value"\/\fR
\fI\,--option "value" --option "value"\/\fR
.SH DESCRIPTION
Neofetch is a CLI system information tool written in BASH. Neofetch
displays information about your system next to an image, your OS logo,
@@ -14,24 +14,6 @@ NOTE: Every launch flag has a config option.
.SH OPTIONS
.SS "INFO:"
.TP
func_name
Specify a function name (second part of info() from config) to
quickly display only that function's information.
.IP
Example: neofetch uptime \fB\-\-uptime_shorthand\fR tiny
.IP
Example: neofetch uptime disk wm memory
.IP
This can be used in bars and scripts like so:
.IP
memory="$(neofetch memory)"; memory="${memory##*: }"
.IP
For multiple outputs at once (each line of info in an array):
.IP
IFS=$'\en' read \fB\-d\fR "" \fB\-ra\fR info < <(neofetch memory uptime wm)
.IP
info=("${info[@]##*: }")
.TP
\fB\-\-disable\fR infoname
Allows you to disable an info line from appearing
in the output. 'infoname' is the function name from the
@@ -138,18 +120,12 @@ Takes: name, mount, dir
\fB\-\-ip_host\fR url
URL to query for public IP
.TP
\fB\-\-ip_timeout\fR int
Public IP timeout (in seconds).
.TP
\fB\-\-song_format\fR format
Print the song data in a specific format (see config file).
.TP
\fB\-\-song_shorthand\fR on/off
Print the Artist/Album/Title on separate lines.
.TP
\fB\-\-memory_percent\fR on/off
Display memory percentage.
.TP
\fB\-\-music_player\fR player\-name
Manually specify a player to use.
Available values are listed in the config file
@@ -217,25 +193,20 @@ Possible values: bar, infobar, barinfo, off
.TP
\fB\-\-backend\fR backend
Which image backend to use.
Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2',
\&'off', 'sixel', 'tycat', 'w3m'
Possible values: 'ascii', 'caca', 'jp2a', 'iterm2', 'off',
\&'sixel', 'tycat', 'w3m'
.TP
\fB\-\-source\fR source
Which image or ascii file to use.
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img',
\&'/path/to/ascii', '/path/to/dir/', 'command output' [ascii]
\&'/path/to/ascii', '/path/to/dir/'
.TP
\fB\-\-ascii\fR source
Shortcut to use 'ascii' backend.
.IP
NEW: neofetch \fB\-\-ascii\fR "$(fortune | cowsay \fB\-W\fR 30)"
.TP
\fB\-\-caca\fR source
Shortcut to use 'caca' backend.
.TP
\fB\-\-chafa\fR source
Shortcut to use 'chafa' backend.
.TP
\fB\-\-iterm2\fR source
Shortcut to use 'iterm2' backend.
.TP