Merge pull request #424 from dylanaraps/2.0

Merge neofetch 2.0 branch
This commit is contained in:
Dylan Araps 2016-11-06 11:04:09 +11:00 committed by GitHub
commit ac1ffbc0ef
6 changed files with 340 additions and 160 deletions

View file

@ -1,26 +1,37 @@
# Neofetch 2.0
## Contributors ## Contributors
- **[@JorgeGonzalez](https://github.com/JorgeGonzalez)** - **[@konimex](https://github.com/konimex)**
- **[@TonCherAmi](https://github.com/TonCherAmi)**
## General
- Fixed issue where info wasn't detected properly but the subtitle was still displayed.
## Operating System ## Operating System
- Added support for DracOS. - Added support for Haiku OS. **[@konimex](https://github.com/konimex)**
- Added support for GNU Hurd. **[@konimex](https://github.com/konimex)**
## Ascii
- Added generic Linux ascii art to display if neofetch doesn't have the right logo for your distro.
- Added Netrunner. **[@konimex](https://github.com/konimex)**
- Added Korora. **[@konimex](https://github.com/konimex)**
# Images
- Fixed images not appearing in st.
## Info ## Info
**Terminal**<br \> **Distro**<br \>
- Added support for HyperTerm. **[@JorgeGonzalez](https://github.com/JorgeGonzalez)** - [Linux] Source `/etc/*-release` files instead of having a dozen separate `awk` commands.
**GPU**<br \>
**Terminal Font**<br \> - [Linux] Properly detect gpu in multi gpu setups. **[@TonCherAmi](https://github.com/TonCherAmi)**
- Added support for HyperTerm. **[@JorgeGonzalez](https://github.com/JorgeGonzalez)**

19
ascii/distro/haiku Normal file
View file

@ -0,0 +1,19 @@
"\
${c2} :dc'
'l:;'${c1},${c2}'ck. .;dc:.
co ${c1}..${c2}k. .;; ':o.
co ${c1}..${c2}k. ol ${c1}.${c2}0.
co ${c1}..${c2}k. oc ${c1}..${c2}0.
co ${c1}..${c2}k. oc ${c1}..${c2}0.
.Ol,. co ${c1}...''${c2}Oc;kkodxOdddOoc,.
';lxxlxOdxkxk0kd${c1}oooll${c2}dl${c1}ccc:${c2}clxd;
..${c1}oOolllllccccccc:::::${c2}od;
cx:ooc${c1}:::::::;${c2}cooolcX.
cd${c1}.${c2}''cloxdoollc' ${c1}...${c2}0.
cd${c1}......${c2}k;${c1}.${c2}xl${c1}.... .${c2}0.
.::c${c1};..${c2}cx;${c1}.${c2}xo${c1}..... .${c2}0.
'::c'${c1}...${c2}do${c1}..... .${c2}K,
cd,.${c1}....:${c2}O,${c1}
':clod:'${c1}
${c1}
"

18
ascii/distro/korora Normal file
View file

@ -0,0 +1,18 @@
"\
${c2} ____________
_add55555555554${c1}:
_w?'${c1}\`\`\`\`\`\`\`\`\`\`'${c2})k${c1}:
_Z'${c1}\`${c2} ]k${c1}:
m(${c1}\`${c2} )k${c1}:
_.ss${c1}\`${c2}m[${c1}\`${c2}, ]e${c1}:
.uY\"^\`${c1}\`${c2}Xc${c1}\`${c2}?Ss. d(${c1}\`
jF'${c1}\`${c2} \`@. ${c1}\`${c2}Sc .jr${c1}\`
jr${c1}\`${c2} \`?n_ ${c1}\`${c2}$; _a2\"${c1}\`
.m${c1}:${c2} \`~M${c1}\`${c2}1k${c1}\`${c2}5?!\`${c1}\`
:#${c1}:${c2} ${c1}\`${c2})e${c1}\`\`\`
:m${c1}:${c2} ,#'${c1}\`
:#${c1}:${c2} .s2'${c1}\`
:m,________.aa7^${c1}\`
:#baaaaaaas!J'${c1}\`
\`\`\`\`\`\`\`\`\`\`\`
"

14
ascii/distro/linux Normal file
View file

@ -0,0 +1,14 @@
"\
${c2} #####
${c2} #######
${c2} ##${c1}O${c2}#${c1}O${c2}##
${c2} #${c3}#####${c2}#
${c2} ##${c1}##${c3}###${c1}##${c2}##
${c2} #${c1}##########${c2}##
${c2} #${c1}############${c2}##
${c2} #${c1}############${c2}###
${c3} ##${c2}#${c1}###########${c2}##${c3}#
${c3}######${c2}#${c1}#######${c2}#${c3}######
${c3}#######${c2}#${c1}#####${c2}#${c3}#######
${c3} #####${c2}#######${c3}#####
"

24
ascii/distro/netrunner Normal file
View file

@ -0,0 +1,24 @@
"\
${c1}nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
nnnnnnnnnnnnnn nnnnnnnnnnnnnn
nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnn nnnnnnnnnnnnnnnnnnnn nnnnnnn
nnnn nnnnnnnnnnnnnnnnnnnnnnnnnn nnnn
nnn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn nnn
nn nnnnnnnnnnnnnnnnnnnnnn nnnnnnnn nn
n nnnnnnnnnnnnnnnnn nnnnnnnnnn n
n nnnnnnnnnnn nnnnnnnnnnn n
n nnnnnn nnnnnnnnnnnn n
n nnnnnnnnnnn nnnnnnnnnnnn n
n nnnnnnnnnnnnn nnnnnnnnnnnn n
n nnnnnnnnnnnnnnnn nnnnnnnnnnnnn n
n nnnnnnnnnnnnnnnnn nnnnnnnnnnnnn n
n nnnnnnnnnnnnnnnnnn nnnnnnnnnnnn n
nn nnnnnnnnnnnnnnnnn nnnnnnnnnnnn nn
nnn nnnnnnnnnnnnnnn nnnnnnnnnnn nnn
nnnnn nnnnnnnnnnnnnn nnnnnnnnn nnnnn
nnnnnnn nnnnnnnnnnnnnnnnnnnn nnnnnnn
nnnnnnnnnn nnnnnnnnnn nnnnnnnnnn
nnnnnnnnnnnnnn nnnnnnnnnnnnnn
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
"

310
neofetch
View file

@ -30,6 +30,8 @@ getos() {
*"BSD" | "DragonFly" | "Bitrig") os="BSD" ;; *"BSD" | "DragonFly" | "Bitrig") os="BSD" ;;
"CYGWIN"*) os="Windows" ;; "CYGWIN"*) os="Windows" ;;
"SunOS") os="Solaris" ;; "SunOS") os="Solaris" ;;
"Haiku") os="Haiku" ;;
"GNU"*) os="GNU" ;;
*) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;; *) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;;
esac esac
} }
@ -98,7 +100,7 @@ getmodel() {
;; ;;
"BSD") "BSD")
model="$(sysctl -n hw.vendor hw.product 2>/dev/null)" model="$(sysctl -n hw.vendor hw.product)"
;; ;;
"Windows") "Windows")
@ -122,13 +124,13 @@ getdistro() {
[ "$distro" ] && return [ "$distro" ] && return
case "$os" in case "$os" in
"Linux" ) "Linux" | "GNU")
if grep -q 'Microsoft' /proc/version >/dev/null 2>&1 || \ if grep -q 'Microsoft' /proc/version >/dev/null || \
grep -q 'Microsoft' /proc/sys/kernel/osrelease >/dev/null 2>&1; then grep -q 'Microsoft' /proc/sys/kernel/osrelease >/dev/null; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on") distro="$(lsb_release -sir 2>/dev/null) [Windows 10]" ;; "on") distro="$(lsb_release -sir) [Windows 10]" ;;
"tiny") distro="Windows 10" ;; "tiny") distro="Windows 10" ;;
*) distro="$(lsb_release -sd 2>/dev/null) on Windows 10" ;; *) distro="$(lsb_release -sd) on Windows 10" ;;
esac esac
ascii_distro="Windows 10" ascii_distro="Windows 10"
@ -138,18 +140,18 @@ getdistro() {
*) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)" *) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)"
esac esac
elif type -p lsb_release >/dev/null 2>&1; then elif type -p lsb_release >/dev/null; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on") lsb_flags="-sir" ;; "on") lsb_flags="-sir" ;;
"tiny") lsb_flags="-si" ;; "tiny") lsb_flags="-si" ;;
*) lsb_flags="-sd" ;; *) lsb_flags="-sd" ;;
esac esac
distro="$(lsb_release $lsb_flags 2>/dev/null)" distro="$(lsb_release $lsb_flags)"
elif type -p guix >/dev/null 2>&1; then elif type -p guix >/dev/null; then
distro="GuixSD" distro="GuixSD"
elif type -p crux >/dev/null 2>&1; then elif type -p crux >/dev/null; then
distro="$(crux)" distro="$(crux)"
case "$distro_shorthand" in case "$distro_shorthand" in
"on") distro="${distro//version}" ;; "on") distro="${distro//version}" ;;
@ -160,26 +162,20 @@ getdistro() {
distro="Android $(getprop ro.build.version.release)" distro="Android $(getprop ro.build.version.release)"
else else
# Workarounds are included in every shorthand option # Source the os-release file
for file in /etc/*ease /usr/lib/*ease; do
source "$file"
done
case "$distro_shorthand" in case "$distro_shorthand" in
"on") "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;;
distro="$(awk -F'=' '/^NAME|VERSION_ID=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)" "tiny") distro="${NAME:-${DISTRIB_ID:-"${TAILS_PRODUCT_NAME}"}}" ;;
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_ID|DISTRIB_RELEASE=/ {print $2}' /etc/openwrt_release)" "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;;
;;
"tiny")
distro="$(awk -F'=' '/^NAME=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '/^TAILS_PRODUCT_NAME=/ {print $2}' /etc/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '/^DISTRIB_ID=/ {print $2}' /etc/openwrt_release)"
;;
*)
distro="$(awk -F'=' '/^PRETTY_NAME=/ {print $2; exit}' /etc/*ease /usr/lib/*ease)"
[ -z "$distro" ] && distro="$(awk -F'=' '{print $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)"
;;
esac esac
# Workarounds for distros that go against the os-release standard.
[ -z "$(trim "$distro")" ] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)"
[ -z "$(trim "$distro")" ] && distro="$(awk -F'=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)"
fi fi
distro="${distro//\"}" distro="${distro//\"}"
distro="${distro//\'}" distro="${distro//\'}"
@ -253,6 +249,10 @@ getdistro() {
esac esac
distro="${distro/\(*}" distro="${distro/\(*}"
;; ;;
"Haiku")
distro="$(uname -sv | awk '{print $1 " " $2}')"
;;
esac esac
# Get architecture # Get architecture
@ -303,6 +303,16 @@ getkernel() {
# Uptime {{{ # Uptime {{{
getuptime() { getuptime() {
# Since Haiku's uptime cannot be fetched in seconds, a case outside
# the usual case is needed
case "$os" in
"Haiku")
uptime="$(uptime -u)"
uptime="${uptime/up }"
;;
*)
# Get uptime in seconds # Get uptime in seconds
case "$os" in case "$os" in
"Linux" | "Windows") "Linux" | "Windows")
@ -348,6 +358,8 @@ getuptime() {
uptime="${days:+$days, }${hours:+$hours, }${minutes}" uptime="${days:+$days, }${hours:+$hours, }${minutes}"
uptime="${uptime%', '}" uptime="${uptime%', '}"
uptime="${uptime:-${seconds} seconds}" uptime="${uptime:-${seconds} seconds}"
;;
esac
# Make the output of uptime smaller. # Make the output of uptime smaller.
case "$uptime_shorthand" in case "$uptime_shorthand" in
@ -376,52 +388,52 @@ getuptime() {
getpackages() { getpackages() {
case "$os" in case "$os" in
"Linux" | "iPhone OS" | "Solaris") "Linux" | "iPhone OS" | "Solaris" | "GNU")
type -p pacman >/dev/null 2>&1 && \ type -p pacman >/dev/null && \
packages="$(pacman -Qq --color never | wc -l)" packages="$(pacman -Qq --color never | wc -l)"
type -p dpkg >/dev/null 2>&1 && \ type -p dpkg >/dev/null && \
packages="$((packages+=$(dpkg --get-selections | grep -cv deinstall$)))" packages="$((packages+=$(dpkg --get-selections | grep -cv deinstall$)))"
type -p /sbin/pkgtool >/dev/null 2>&1 && \ type -p /sbin/pkgtool >/dev/null && \
packages="$((packages+=$(ls -1 /var/log/packages | wc -l)))" packages="$((packages+=$(ls -1 /var/log/packages | wc -l)))"
type -p rpm >/dev/null 2>&1 && \ type -p rpm >/dev/null && \
packages="$((packages+=$(rpm -qa | wc -l)))" packages="$((packages+=$(rpm -qa | wc -l)))"
type -p xbps-query >/dev/null 2>&1 && \ type -p xbps-query >/dev/null && \
packages="$((packages+=$(xbps-query -l | wc -l)))" packages="$((packages+=$(xbps-query -l | wc -l)))"
type -p pkginfo >/dev/null 2>&1 && \ type -p pkginfo >/dev/null && \
packages="$((packages+=$(pkginfo -i | wc -l)))" packages="$((packages+=$(pkginfo -i | wc -l)))"
type -p pisi >/dev/null 2>&1 && \ type -p pisi >/dev/null && \
packages="$((packages+=$(pisi list-installed | wc -l)))" packages="$((packages+=$(pisi list-installed | wc -l)))"
if type -p pkg >/dev/null 2>&1; then if type -p pkg >/dev/null; then
packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))" packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))"
[ "$packages" == "0" ] && packages="$((packages+=$(pkg list | wc -l)))" [ "$packages" == "0" ] && packages="$((packages+=$(pkg list | wc -l)))"
fi fi
type -p emerge >/dev/null 2>&1 && \ type -p emerge >/dev/null && \
packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))" packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))"
type -p nix-env >/dev/null 2>&1 && \ type -p nix-env >/dev/null && \
packages="$((packages+=$(ls -d -1 /nix/store/*/ | wc -l)))" packages="$((packages+=$(ls -d -1 /nix/store/*/ | wc -l)))"
type -p guix >/dev/null 2>&1 && \ type -p guix >/dev/null && \
packages="$((packages+=$(ls -d -1 /gnu/store/*/ | wc -l)))" packages="$((packages+=$(ls -d -1 /gnu/store/*/ | wc -l)))"
type -p apk >/dev/null 2>&1 && \ type -p apk >/dev/null && \
packages="$((packages+=$(apk info | wc -l)))" packages="$((packages+=$(apk info | wc -l)))"
type -p opkg >/dev/null 2>&1 && \ type -p opkg >/dev/null && \
packages="$((packages+=$(opkg list-installed | wc -l)))" packages="$((packages+=$(opkg list-installed | wc -l)))"
type -p pacman-g2 >/dev/null 2>&1 && \ type -p pacman-g2 >/dev/null && \
packages="$((packages+=$(pacman-g2 -Q | wc -l)))" packages="$((packages+=$(pacman-g2 -Q | wc -l)))"
type -p cave >/dev/null 2>&1 && \ type -p cave >/dev/null && \
packages="$((packages+=$(ls -d -1 /var/db/paludis/repositories/cross-installed/*/data/* /var/db/paludis/repositories/installed/data/* | wc -l)))" packages="$((packages+=$(ls -d -1 /var/db/paludis/repositories/cross-installed/*/data/* /var/db/paludis/repositories/installed/data/* | wc -l)))"
;; ;;
@ -429,14 +441,14 @@ getpackages() {
[ -d "/usr/local/bin" ] && \ [ -d "/usr/local/bin" ] && \
packages="$(($(ls -l /usr/local/bin/ | grep -v "\(../Cellar/\|brew\)" | wc -l) - 1))" packages="$(($(ls -l /usr/local/bin/ | grep -v "\(../Cellar/\|brew\)" | wc -l) - 1))"
type -p port >/dev/null 2>&1 && \ type -p port >/dev/null && \
packages="$((packages + $(port installed 2>/dev/null | wc -l) - 1))" packages="$((packages + $(port installed | wc -l) - 1))"
type -p brew >/dev/null 2>&1 && \ type -p brew >/dev/null && \
packages="$((packages + $(find /usr/local/Cellar -maxdepth 1 2>/dev/null | wc -l) - 1))" packages="$((packages + $(find /usr/local/Cellar -maxdepth 1 | wc -l) - 1))"
type -p pkgin >/dev/null 2>&1 && \ type -p pkgin >/dev/null && \
packages="$((packages + $(pkgin list 2>/dev/null | wc -l)))" packages="$((packages + $(pkgin list | wc -l)))"
;; ;;
"BSD") "BSD")
@ -445,9 +457,9 @@ getpackages() {
"PacBSD"*) packages="$(pacman -Qq --color never | wc -l)" ;; "PacBSD"*) packages="$(pacman -Qq --color never | wc -l)" ;;
*) *)
if type -p pkg_info >/dev/null 2>&1; then if type -p pkg_info >/dev/null; then
packages="$(pkg_info | wc -l)" packages="$(pkg_info | wc -l)"
elif type -p pkg >/dev/null 2>&1; then elif type -p pkg >/dev/null; then
packages="$(pkg info | wc -l)" packages="$(pkg info | wc -l)"
fi fi
;; ;;
@ -461,6 +473,10 @@ getpackages() {
[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ] && \ [ -d "/cygdrive/c/ProgramData/chocolatey/lib" ] && \
packages="$((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)))" packages="$((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)))"
;; ;;
"Haiku")
packages="$(ls -1 /boot/system/package-links | wc -l)"
;;
esac esac
[ "$packages" == "0" ] && unset packages [ "$packages" == "0" ] && unset packages
@ -529,12 +545,12 @@ getde() {
esac esac
if [ -n "$DISPLAY" ] && [ -z "$de" ]; then if [ -n "$DISPLAY" ] && [ -z "$de" ]; then
de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/' 2>/dev/null)" de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/')"
case "$de" in case "$de" in
"KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;; "KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;;
*"TDE_FULL_SESSION"*) de="Trinity" ;; *"TDE_FULL_SESSION"*) de="Trinity" ;;
*"MUFFIN"*) de="$(cinnamon --version 2>/dev/null)"; de="${de:-Cinnamon}" ;; *"MUFFIN"*) de="$(cinnamon --version)"; de="${de:-Cinnamon}" ;;
*"xfce4"*) de="XFCE4" ;; *"xfce4"*) de="XFCE4" ;;
*"xfce5"*) de="XFCE5" ;; *"xfce5"*) de="XFCE5" ;;
esac esac
@ -547,8 +563,8 @@ getde() {
getwm() { getwm() {
if [ -n "$DISPLAY" ] && [ "$os" != "Mac OS X" ]; then if [ -n "$DISPLAY" ] && [ "$os" != "Mac OS X" ]; then
id="$(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}' 2>/dev/null)" id="$(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}')"
wm="$(xprop -id "$id" -notype -f _NET_WM_NAME 8t 2>/dev/null)" wm="$(xprop -id "$id" -notype -f _NET_WM_NAME 8t)"
wm="${wm/*_NET_WM_NAME = }" wm="${wm/*_NET_WM_NAME = }"
wm="${wm/\"}" wm="${wm/\"}"
wm="${wm/\"*}" wm="${wm/\"*}"
@ -589,28 +605,28 @@ getwmtheme() {
;; ;;
"Compiz" | "Mutter" | "GNOME Shell" | "Gala") "Compiz" | "Mutter" | "GNOME Shell" | "Gala")
if type -p gsettings >/dev/null 2>&1; then if type -p gsettings >/dev/null; then
wmtheme="$(gsettings get org.gnome.shell.extensions.user-theme name)" wmtheme="$(gsettings get org.gnome.shell.extensions.user-theme name)"
[ -z "${wmtheme//\'}" ] && \ [ -z "${wmtheme//\'}" ] && \
wmtheme="$(gsettings get org.gnome.desktop.wm.preferences theme)" wmtheme="$(gsettings get org.gnome.desktop.wm.preferences theme)"
elif type -p gconftool-2 >/dev/null 2>&1; then elif type -p gconftool-2 >/dev/null; then
wmtheme="$(gconftool-2 -g /apps/metacity/general/theme)" wmtheme="$(gconftool-2 -g /apps/metacity/general/theme)"
fi fi
;; ;;
"Metacity"*) "Metacity"*)
if [ "$de" == "Deepin" ]; then if [ "$de" == "Deepin" ]; then
wmtheme="$(gsettings get com.deepin.wrap.gnome.desktop.wm.preferences theme 2>/dev/null)" wmtheme="$(gsettings get com.deepin.wrap.gnome.desktop.wm.preferences theme)"
else else
wmtheme="$(gconftool-2 -g /apps/metacity/general/theme 2>/dev/null)" wmtheme="$(gconftool-2 -g /apps/metacity/general/theme)"
fi fi
;; ;;
"E17" | "Enlightenment") "E17" | "Enlightenment")
if type -p eet >/dev/null 2>&1; then if type -p eet >/dev/null; then
wmtheme="$(eet -d "$HOME/.e/e/config/standard/e.cfg" config | awk '/value \"file\" string.*.edj/ {print $4}')" wmtheme="$(eet -d "$HOME/.e/e/config/standard/e.cfg" config | awk '/value \"file\" string.*.edj/ {print $4}')"
wmtheme="${wmtheme##*/}" wmtheme="${wmtheme##*/}"
wmtheme="${wmtheme%.*}" wmtheme="${wmtheme%.*}"
@ -673,7 +689,7 @@ getwmtheme() {
path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft" path="/proc/registry/HKEY_CURRENT_USER/Software/Microsoft"
path+="/Windows/CurrentVersion/Themes/CurrentTheme" path+="/Windows/CurrentVersion/Themes/CurrentTheme"
wmtheme="$(head -n1 "$path" 2>/dev/null)" wmtheme="$(head -n1 "$path")"
wmtheme="${wmtheme##*\\}" wmtheme="${wmtheme##*\\}"
wmtheme="${wmtheme%.*}" wmtheme="${wmtheme%.*}"
;; ;;
@ -845,6 +861,24 @@ getcpu() {
cpu="$cpu @ ${speed}GHz" cpu="$cpu @ ${speed}GHz"
;; ;;
"Haiku")
cpu="$(sysinfo -cpu | awk -F '\\"' '/CPU #0/ {print $2}')"
cpu="${cpu/@*}"
speed="$(sysinfo -cpu | awk '/running at/ {print $NF; exit}')"
speed="${speed/MHz}"
speed="$((speed / 100))"
cores="$(sysinfo -cpu | grep -c 'CPU #')"
# Fix for speed under 1ghz
if [ -z ] "${speed:1}"; then
speed="0.${speed}"
else
speed="${speed:0:1}.${speed:1}"
fi
cpu="$cpu @ ${speed}GHz"
;;
esac esac
# Remove uneeded patterns from cpu output # Remove uneeded patterns from cpu output
@ -899,7 +933,7 @@ getcpu_usage() {
cpu_usage="${cpu_usage//[[:space:]]}" cpu_usage="${cpu_usage//[[:space:]]}"
;; ;;
"Linux" | "Mac OS X" | "iPhone OS" | "BSD" | "Solaris") "Linux" | "Mac OS X" | "iPhone OS" | "BSD" | "Solaris" | "GNU")
# Get cores if unset # Get cores if unset
if [ -z "$cores" ]; then if [ -z "$cores" ]; then
case "$os" in case "$os" in
@ -929,13 +963,22 @@ getcpu_usage() {
getgpu() { getgpu() {
case "$os" in case "$os" in
"Linux") "Linux" | "GNU")
# Use cache if it exists # Use cache if it exists
if [ -f "/tmp/neofetch/gpu" ]; then if [ -f "/tmp/neofetch/gpu" ]; then
source "/tmp/neofetch/gpu" source "/tmp/neofetch/gpu"
else else
bdf_number="$(PATH="/sbin:$PATH" lspci -k | grep -A2 'VGA' | grep -B2 'Kernel driver in use' | awk '/^\w/ {print $1}')"
if [ -z "$bdf_number" ]; then
# Fallback if no kernel driver is in use
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')"
else
# Find the currently used GPU by its BDF
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -v bdf_number="$bdf_number" -F '\\"|\\" \\"' '$0 ~ bdf_number {print $3 " " $4}')"
fi
case "$gpu" in case "$gpu" in
intel*) gpu="Intel Integrated Graphics" ;; intel*) gpu="Intel Integrated Graphics" ;;
@ -1009,7 +1052,7 @@ getgpu() {
"BSD" | "Solaris") "BSD" | "Solaris")
case "$distro" in case "$distro" in
"FreeBSD"* | "DragonFlyBSD"* | "PacBSD"*) "FreeBSD"* | "DragonFlyBSD"* | "PacBSD"*)
gpu="$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")" gpu="$(pciconf -lv | grep -B 4 "VGA" | grep "device")"
gpu="${gpu/*device*= }" gpu="${gpu/*device*= }"
gpu="${gpu//\'}" gpu="${gpu//\'}"
;; ;;
@ -1025,6 +1068,10 @@ getgpu() {
gpu="$(wmic path Win32_VideoController get caption /value)" gpu="$(wmic path Win32_VideoController get caption /value)"
gpu="${gpu/Caption'='}" gpu="${gpu/Caption'='}"
;; ;;
"Haiku")
gpu="$(listdev | grep -A2 -e 'device Display controller' | awk -F':' '/device beef/ {print $2}')"
;;
esac esac
if [ "$gpu_brand" == "off" ]; then if [ "$gpu_brand" == "off" ]; then
@ -1040,7 +1087,7 @@ getgpu() {
getmemory() { getmemory() {
case "$os" in case "$os" in
"Linux" | "Windows") "Linux" | "Windows" | "GNU")
# MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable # MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
# Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716 # Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716
while IFS=":" read -r a b; do while IFS=":" read -r a b; do
@ -1085,6 +1132,12 @@ getmemory() {
memfree="$(($(sar -r 1 1 | tail -1 | awk 'BEGIN {FS=" "} {print $2}') / 1024))" memfree="$(($(sar -r 1 1 | tail -1 | awk 'BEGIN {FS=" "} {print $2}') / 1024))"
memused="$((memtotal - memfree))" memused="$((memtotal - memfree))"
;; ;;
"Haiku")
memtotal="$(($(sysinfo -mem | awk -F '\\/ |)' '{print $2; exit}') / 1024 / 1024))"
memused="$(sysinfo -mem | awk -F '\\/|)' '{print $2; exit}')"
memused="$((${memused/max} / 1024 / 1024))"
;;
esac esac
memory="${memused}MB / ${memtotal}MB" memory="${memused}MB / ${memtotal}MB"
@ -1106,13 +1159,13 @@ getsong() {
case "${player/*\/}" in case "${player/*\/}" in
"mpd"*) "mpd"*)
song="$(mpc current 2>/dev/null)" song="$(mpc current)"
state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)" state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}')"
;; ;;
"cmus"*) "cmus"*)
IFS=$'\n' IFS=$'\n'
song=($(cmus-remote -Q | grep "tag artist \|tag title \|status" 2>/dev/null | sort)) song=($(cmus-remote -Q | grep "tag artist \|tag title \|status" | sort))
state="${song[0]/status }" state="${song[0]/status }"
artist="${song[1]/tag artist }" artist="${song[1]/tag artist }"
title="${song[2]/tag title }" title="${song[2]/tag title }"
@ -1120,8 +1173,8 @@ getsong() {
;; ;;
"mocp"*) "mocp"*)
song="$(mocp -Q "%artist - %song" 2>/dev/null)" song="$(mocp -Q "%artist - %song")"
state="$(mocp -Q "%state" 2>/dev/null)" state="$(mocp -Q "%state")"
;; ;;
"spotify"*) "spotify"*)
@ -1147,8 +1200,8 @@ getsong() {
;; ;;
"google play"*) "google play"*)
song="$(gpmdp-remote current 2>/dev/null)" song="$(gpmdp-remote current)"
state="$(gpmdp-remote status 2>/dev/null)" state="$(gpmdp-remote status)"
;; ;;
"itunes"*) "itunes"*)
@ -1220,8 +1273,8 @@ getsong() {
getresolution() { getresolution() {
case "$os" in case "$os" in
"Linux" | "BSD" | "Solaris") "Linux" | "BSD" | "Solaris" | "GNU")
if type -p xrandr >/dev/null 2>&1; then 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]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;; "on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;;
"off") resolution="$(xrandr --nograb --current | awk '/\*/ {printf $1 ", "}')" ;; "off") resolution="$(xrandr --nograb --current | awk '/\*/ {printf $1 ", "}')" ;;
@ -1229,14 +1282,14 @@ getresolution() {
resolution="${resolution//\*}" resolution="${resolution//\*}"
resolution="${resolution//\.[0-9][0-9]}" resolution="${resolution//\.[0-9][0-9]}"
elif type -p xdpyinfo >/dev/null 2>&1; then elif type -p xdpyinfo >/dev/null; then
resolution="$(xdpyinfo 2>/dev/null | awk '/dimensions:/ {printf $2}')" resolution="$(xdpyinfo | awk '/dimensions:/ {printf $2}')"
fi fi
;; ;;
"Mac OS X") "Mac OS X")
if type -p screenresolution >/dev/null 2>&1; then if type -p screenresolution >/dev/null; then
resolution="$(screenresolution get 2>&1 | awk '/Display/ {printf $6 "Hz, "}')" resolution="$(screenresolution get | awk '/Display/ {printf $6 "Hz, "}')"
resolution="${resolution//x??@/ @ }" resolution="${resolution//x??@/ @ }"
else else
@ -1259,15 +1312,23 @@ getresolution() {
;; ;;
"Windows") "Windows")
width="$(wmic path Win32_VideoController get CurrentHorizontalResolution /value 2>/dev/null)" width="$(wmic path Win32_VideoController get CurrentHorizontalResolution /value)"
width="${width/CurrentHorizontalResolution'='/}" width="${width/CurrentHorizontalResolution'='/}"
height="$(wmic path Win32_VideoController get CurrentVerticalResolution /value 2>/dev/null)" height="$(wmic path Win32_VideoController get CurrentVerticalResolution /value)"
height="${height/CurrentVerticalResolution'='/}" height="${height/CurrentVerticalResolution'='/}"
[ "$width" ] && \ [ "$width" ] && \
resolution="${width}x${height}" resolution="${width}x${height}"
;; ;;
"Haiku")
resolution="$(screenmode | awk -F ' |, ' '{printf $2 "x" $3 " @ " $6 $7}')"
case "$refresh_rate" in
"off") resolution="${resolution/ @*}" ;;
esac
;;
esac esac
resolution="${resolution%,*}" resolution="${resolution%,*}"
@ -1329,18 +1390,18 @@ getstyle() {
;; ;;
*"Cinnamon") *"Cinnamon")
if type -p gsettings >/dev/null 2>&1; then if type -p gsettings >/dev/null; then
gtk3theme="$(gsettings get org.cinnamon.desktop.interface "$gsettings")" gtk3theme="$(gsettings get org.cinnamon.desktop.interface "$gsettings")"
gtk2theme="${gtk3theme}" gtk2theme="${gtk3theme}"
fi fi
;; ;;
"Gnome"* | "Unity"* | "Budgie"*) "Gnome"* | "Unity"* | "Budgie"*)
if type -p gsettings >/dev/null 2>&1; then if type -p gsettings >/dev/null; then
gtk3theme="$(gsettings get org.gnome.desktop.interface "$gsettings")" gtk3theme="$(gsettings get org.gnome.desktop.interface "$gsettings")"
gtk2theme="${gtk3theme}" gtk2theme="${gtk3theme}"
elif type -p gconftool-2 >/dev/null 2>&1; then elif type -p gconftool-2 >/dev/null; then
gtk2theme="$(gconftool-2 -g /desktop/gnome/interface/"$gconf")" gtk2theme="$(gconftool-2 -g /desktop/gnome/interface/"$gconf")"
fi fi
;; ;;
@ -1351,7 +1412,7 @@ getstyle() {
;; ;;
"Xfce"*) "Xfce"*)
type -p xfconf-query >/dev/null 2>&1 && \ type -p xfconf-query >/dev/null && \
gtk2theme="$(xfconf-query -c xsettings -p "$xfconf")" gtk2theme="$(xfconf-query -c xsettings -p "$xfconf")"
;; ;;
esac esac
@ -1376,7 +1437,7 @@ getstyle() {
if [ -f "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" ]; then if [ -f "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" ]; then
gtk3theme="$(grep "^[^#]*$name" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini")" gtk3theme="$(grep "^[^#]*$name" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini")"
elif type -p gsettings >/dev/null 2>&1; then elif type -p gsettings >/dev/null; then
gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)" gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)"
elif [ -f "/usr/share/gtk-3.0/settings.ini" ]; then elif [ -f "/usr/share/gtk-3.0/settings.ini" ]; then
@ -1557,7 +1618,7 @@ gettermfont() {
getdisk() { getdisk() {
# df flags # df flags
case "$os" in case "$os" in
"Linux" | "iPhone OS" | "Windows" | "Solaris") "Linux" | "iPhone OS" | "Windows" | "Solaris" | "GNU")
df_flags="-h -l --total" df_flags="-h -l --total"
df_dir="total" df_dir="total"
@ -1567,7 +1628,7 @@ getdisk() {
esac esac
;; ;;
"Mac OS X" | "BSD") "Mac OS X" | "BSD" | "Haiku")
case "$distro" in case "$distro" in
"FreeBSD"* | *"OS X"* | "Mac"* ) "FreeBSD"* | *"OS X"* | "Mac"* )
df_flags="-l -H /" df_flags="-l -H /"
@ -1580,7 +1641,7 @@ getdisk() {
esac esac
# Get the disk info # Get the disk info
disk="$(df $df_flags 2>/dev/null | awk -v dir="$df_dir" '$0 ~ dir {print $2 ":" $3 ":" $5}')" disk="$(df $df_flags | awk -v dir="$df_dir" '$0 ~ dir {print $2 ":" $3 ":" $5}')"
# Format the output # Format the output
disk_used="${disk#*:}" disk_used="${disk#*:}"
@ -1685,6 +1746,12 @@ getbattery() {
[ "$battery" ] && \ [ "$battery" ] && \
battery+="%" battery+="%"
;; ;;
"Haiku")
battery0full="$(awk -F '[^0-9]*' 'NR==2 {print $4}' /dev/power/acpi_battery/0)"
battery0now="$(awk -F '[^0-9]*' 'NR==5 {print $4}' /dev/power/acpi_battery/0)"
battery="$((battery0full / battery0now * 100))%"
;;
esac esac
case "$battery_state" in case "$battery_state" in
@ -1720,20 +1787,25 @@ getlocalip() {
"Windows") "Windows")
localip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2}')" localip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2}')"
;; ;;
"Haiku")
localip="$(ifconfig | awk -F ': ' '/Bcast/ {print $2}')"
localip="${localip/', Bcast'}"
;;
esac esac
} }
getpublicip() { getpublicip() {
if type -p dig >/dev/null 2>&1; then if type -p dig >/dev/null; then
publicip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com 2>/dev/null)" publicip="$(dig +time=1 +tries=1 +short myip.opendns.com @resolver1.opendns.com)"
fi fi
if [ -z "$publicip" ] && type -p curl >/dev/null 2>&1; then if [ -z "$publicip" ] && type -p curl >/dev/null; then
publicip="$(curl --max-time 10 -w '\n' "$public_ip_host" 2>/dev/null)" publicip="$(curl --max-time 10 -w '\n' "$public_ip_host")"
fi fi
if [ -z "$publicip" ] && type -p wget >/dev/null 2>&1; then if [ -z "$publicip" ] && type -p wget >/dev/null; then
publicip="$(wget -T 10 -qO- "$public_ip_host" 2>/dev/null; printf "%s")" publicip="$(wget -T 10 -qO- "$public_ip_host"; printf "%s")"
fi fi
} }
@ -1752,7 +1824,7 @@ getusers() {
getbirthday() { getbirthday() {
case "$os" in case "$os" in
"linux" | "iPhone OS") "Linux" | "GNU" | "iPhone OS")
birthday="$(ls -alct --full-time / | awk '/lost\+found|private/ {printf $6 " " $7}')" birthday="$(ls -alct --full-time / | awk '/lost\+found|private/ {printf $6 " " $7}')"
date_cmd="$(date -d"$birthday" "$birthday_format")" date_cmd="$(date -d"$birthday" "$birthday_format")"
;; ;;
@ -1800,6 +1872,11 @@ getbirthday() {
birthday="$(ls -alct --full-time /var/sadm/system/logs/install_log | awk '{printf $6 " " $7}')" birthday="$(ls -alct --full-time /var/sadm/system/logs/install_log | awk '{printf $6 " " $7}')"
date_cmd="$(date -d"$birthday" "$birthday_format")" date_cmd="$(date -d"$birthday" "$birthday_format")"
;; ;;
"Haiku")
birthday="$(ls -alctd --full-time /boot | awk '{printf $6 " " $7}')"
date_cmd="$(date -d"$birthday" "$birthday_format")"
;;
esac esac
# Strip seconds from time output # Strip seconds from time output
@ -1858,19 +1935,19 @@ getcols() {
getwallpaper() { getwallpaper() {
case "$os" in case "$os" in
"Linux" | "BSD") "Linux" | "BSD")
if type -p feh >/dev/null 2>&1 && [ -f "$HOME/.fehbg" ]; then if type -p feh >/dev/null && [ -f "$HOME/.fehbg" ]; then
img="$(awk -F\' '/feh/ {printf $2}' "$HOME/.fehbg")" img="$(awk -F\' '/feh/ {printf $2}' "$HOME/.fehbg")"
elif type -p nitrogen >/dev/null 2>&1; then elif type -p nitrogen >/dev/null; then
img="$(awk -F'=' '/file/ {printf $2;exit;}' "$XDG_CONFIG_HOME/nitrogen/bg-saved.cfg")" img="$(awk -F'=' '/file/ {printf $2;exit;}' "$XDG_CONFIG_HOME/nitrogen/bg-saved.cfg")"
elif type -p gsettings >/dev/null 2>&1; then elif type -p gsettings >/dev/null; then
# Get DE if user has disabled the function. # Get DE if user has disabled the function.
[ -z "$de" ] && getde [ -z "$de" ] && getde
case "$de" in case "$de" in
"MATE"*) img="$(gsettings get org.mate.background picture-filename 2>/dev/null)" ;; "MATE"*) img="$(gsettings get org.mate.background picture-filename)" ;;
*) img="$(gsettings get org.gnome.desktop.background picture-uri 2>/dev/null)" ;; *) img="$(gsettings get org.gnome.desktop.background picture-uri)" ;;
esac esac
# Strip quotes etc from the path. # Strip quotes etc from the path.
@ -1989,7 +2066,7 @@ getimage() {
type -p convert >/dev/null 2>&1 || image="ascii" type -p convert >/dev/null 2>&1 || image="ascii"
case "$image" in case "$image" in
"wall") getwallpaper ;; "wall") getwallpaper 2>/dev/null ;;
"ascii") getascii; return ;; "ascii") getascii; return ;;
*) *)
if [ -d "$image" ]; then if [ -d "$image" ]; then
@ -2223,7 +2300,7 @@ displayimage() {
# appearing in specific terminal emulators. # appearing in specific terminal emulators.
sleep 0.05 sleep 0.05
printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\ printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\
$w3m_img_path -bg "$background_color" 2>/dev/null || padding="\033[0C" $w3m_img_path -bg "$background_color" >/dev/null & 2>&1 || padding="\033[0C"
;; ;;
"iterm2") "iterm2")
@ -2454,11 +2531,11 @@ colors() {
ascii_distro="redhat" ascii_distro="redhat"
;; ;;
"Kogaion"* | "Elementary"* | "GalliumOS"* | "Rosa"* | "OpenWrt"*) "Kogaion"* | "Elementary"* | "GalliumOS"* | "Rosa"* | "OpenWrt"* | "Netrunner"*)
setcolors 4 7 setcolors 4 7
;; ;;
"Fedora"* | "Sabayon"* | "Frugalware"* | "Exherbo"*) "Fedora"* | "Korora"* | "Sabayon"* | "Frugalware"* | "Exherbo"*)
setcolors 4 7 1 setcolors 4 7 1
;; ;;
@ -2561,9 +2638,26 @@ colors() {
setcolors 1 2 4 3 setcolors 1 2 4 3
;; ;;
"Raspbian"* | *) "Haiku"*)
setcolors 2 0
;;
"Raspbian"*)
setcolors 2 1 setcolors 2 1
;; ;;
"Linux")
setcolors fg 8 3
;;
*)
case "$os" in
"Linux")
ascii_distro="linux"
setcolors fg 8 3
;;
esac
;;
esac esac
# Overwrite distro colors if '$ascii_colors' doesn't # Overwrite distro colors if '$ascii_colors' doesn't
@ -2888,7 +2982,7 @@ dynamicprompt() {
fi fi
# Add some padding # Add some padding
printf "\n\n" printf "\n\n\n"
} }
# }}} # }}}
@ -3254,7 +3348,7 @@ main() {
fi fi
# Print the info # Print the info
printinfo printinfo 2>/dev/null
# Prompt calculation # Prompt calculation
if [ "$image" != "off" ]; then if [ "$image" != "off" ]; then