This commit is contained in:
Dylan Araps
2016-11-05 11:53:18 +11:00
parent e9059f8e24
commit 03aebe277c
2 changed files with 115 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ getos() {
"CYGWIN"*) os="Windows" ;;
"SunOS") os="Solaris" ;;
"Haiku") os="Haiku" ;;
"GNU"*) os="GNU" ;;
*) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;;
esac
}
@@ -123,7 +124,7 @@ getdistro() {
[ "$distro" ] && return
case "$os" in
"Linux" )
"Linux" | "GNU")
if grep -q 'Microsoft' /proc/version >/dev/null 2>&1 || \
grep -q 'Microsoft' /proc/sys/kernel/osrelease >/dev/null 2>&1; then
case "$distro_shorthand" in
@@ -387,7 +388,7 @@ getuptime() {
getpackages() {
case "$os" in
"Linux" | "iPhone OS" | "Solaris")
"Linux" | "iPhone OS" | "Solaris" | "GNU")
type -p pacman >/dev/null 2>&1 && \
packages="$(pacman -Qq --color never | wc -l)"
@@ -932,7 +933,7 @@ getcpu_usage() {
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
if [ -z "$cores" ]; then
case "$os" in
@@ -962,7 +963,7 @@ getcpu_usage() {
getgpu() {
case "$os" in
"Linux")
"Linux" | "GNU")
# Use cache if it exists
if [ -f "/tmp/neofetch/gpu" ]; then
source "/tmp/neofetch/gpu"
@@ -1077,7 +1078,7 @@ getgpu() {
getmemory() {
case "$os" in
"Linux" | "Windows")
"Linux" | "Windows" | "GNU")
# MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
# Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716
while IFS=":" read -r a b; do
@@ -1263,7 +1264,7 @@ getsong() {
getresolution() {
case "$os" in
"Linux" | "BSD" | "Solaris")
"Linux" | "BSD" | "Solaris" | "GNU")
if type -p xrandr >/dev/null 2>&1; then
case "$refresh_rate" in
"on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;;
@@ -1608,7 +1609,7 @@ gettermfont() {
getdisk() {
# df flags
case "$os" in
"Linux" | "iPhone OS" | "Windows" | "Solaris")
"Linux" | "iPhone OS" | "Windows" | "Solaris" | "GNU")
df_flags="-h -l --total"
df_dir="total"
@@ -1814,7 +1815,7 @@ getusers() {
getbirthday() {
case "$os" in
"linux" | "iPhone OS")
"Linux" | "GNU" | "iPhone OS")
birthday="$(ls -alct --full-time / | awk '/lost\+found|private/ {printf $6 " " $7}')"
date_cmd="$(date -d"$birthday" "$birthday_format")"
;;