Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
880e6a43
Commit
880e6a43
authored
Nov 06, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Misc: Combine tests
parent
95d2eea0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
neofetch
neofetch
+18
-17
No files found.
neofetch
View file @
880e6a43
...
@@ -43,7 +43,7 @@ getos() {
...
@@ -43,7 +43,7 @@ getos() {
getmodel
()
{
getmodel
()
{
case
"
$os
"
in
case
"
$os
"
in
"Linux"
)
"Linux"
)
if
[[
-d
"/system/app/"
]]
&&
[[
-d
"/system/priv-app"
]]
;
then
if
[[
-d
"/system/app/"
&&
-d
"/system/priv-app"
]]
;
then
model
=
"
$(
getprop ro.product.brand
)
$(
getprop ro.product.model
)
"
model
=
"
$(
getprop ro.product.brand
)
$(
getprop ro.product.model
)
"
elif
[[
-f
/sys/devices/virtual/dmi/id/product_name
]]
||
\
elif
[[
-f
/sys/devices/virtual/dmi/id/product_name
]]
||
\
...
@@ -160,7 +160,7 @@ getdistro() {
...
@@ -160,7 +160,7 @@ getdistro() {
"tiny"
)
distro
=
"
${
distro
//version*
}
"
;;
"tiny"
)
distro
=
"
${
distro
//version*
}
"
;;
esac
esac
elif
[[
-d
"/system/app/"
]]
&&
[[
-d
"/system/priv-app"
]]
;
then
elif
[[
-d
"/system/app/"
&&
-d
"/system/priv-app"
]]
;
then
distro
=
"Android
$(
getprop ro.build.version.release
)
"
distro
=
"Android
$(
getprop ro.build.version.release
)
"
else
else
...
@@ -169,6 +169,7 @@ getdistro() {
...
@@ -169,6 +169,7 @@ getdistro() {
source
"
$file
"
source
"
$file
"
done
done
# The 3rd line down matches the fold marker syntax. {{{
case
"
$distro_shorthand
"
in
case
"
$distro_shorthand
"
in
"on"
)
distro
=
"
${
NAME
:-${
DISTRIB_ID
}}
${
VERSION_ID
:-${
DISTRIB_RELEASE
}}
"
;;
"on"
)
distro
=
"
${
NAME
:-${
DISTRIB_ID
}}
${
VERSION_ID
:-${
DISTRIB_RELEASE
}}
"
;;
"tiny"
)
distro
=
"
${
NAME
:-${
DISTRIB_ID
:-${
TAILS_PRODUCT_NAME
}}}
"
;;
"tiny"
)
distro
=
"
${
NAME
:-${
DISTRIB_ID
:-${
TAILS_PRODUCT_NAME
}}}
"
;;
...
@@ -282,7 +283,7 @@ getkernel() {
...
@@ -282,7 +283,7 @@ getkernel() {
esac
esac
# Hardcode kernel settings in BSDs
# Hardcode kernel settings in BSDs
if [[ "
$os
" == "
BSD
"
]] && [[
! "
$distro
" =~ (PacBSD|PCBSD) ]]; then
if [[ "
$os
" == "
BSD
"
&&
! "
$distro
" =~ (PacBSD|PCBSD) ]]; then
case "
$distro_shorthand
" in
case "
$distro_shorthand
" in
"
on
" | "
tiny
") kernel=
$(
uname
-r
)
;;
"
on
" | "
tiny
") kernel=
$(
uname
-r
)
;;
*) unset kernel ;;
*) unset kernel ;;
...
@@ -538,7 +539,7 @@ getde() {
...
@@ -538,7 +539,7 @@ 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/'
)
"
de="
$(
xprop
-root
|
awk
'/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/'
)
"
case "
$de
" in
case "
$de
" in
...
@@ -556,7 +557,7 @@ getde() {
...
@@ -556,7 +557,7 @@ getde() {
# Window Manager {{{
# Window Manager {{{
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}'
)
"
id="
$(
xprop
-root
-notype
|
awk
'$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}'
)
"
wm="
$(
xprop
-id
"
$id
"
-notype
-f
_NET_WM_NAME 8t
)
"
wm="
$(
xprop
-id
"
$id
"
-notype
-f
_NET_WM_NAME 8t
)
"
wm="
${
wm
/*_NET_WM_NAME =
}
"
wm="
${
wm
/*_NET_WM_NAME =
}
"
...
@@ -638,7 +639,7 @@ getwmtheme() {
...
@@ -638,7 +639,7 @@ getwmtheme() {
;;
;;
"Openbox"
)
"Openbox"
)
if [[
"
$de
"
==
"LXDE"
]] && [[
-f
"
${
HOME
}
/.config/openbox/lxde-rc.xml"
]]; then
if [[
"
$de
"
==
"LXDE"
&&
-f
"
${
HOME
}
/.config/openbox/lxde-rc.xml"
]]; then
ob_file=
"lxde-rc"
ob_file=
"lxde-rc"
elif [[ -f
"
${
HOME
}
/.config/openbox/rc.xml"
]]; then
elif [[ -f
"
${
HOME
}
/.config/openbox/rc.xml"
]]; then
...
@@ -672,7 +673,7 @@ getwmtheme() {
...
@@ -672,7 +673,7 @@ getwmtheme() {
"Quartz Compositor"
)
"Quartz Compositor"
)
wmtheme=
"
$(
/usr/libexec/PlistBuddy
-c
"Print AppleAquaColorVariant"
~/Library/Preferences/.GlobalPreferences.plist
)
"
wmtheme=
"
$(
/usr/libexec/PlistBuddy
-c
"Print AppleAquaColorVariant"
~/Library/Preferences/.GlobalPreferences.plist
)
"
if [[ -z
"
$wmtheme
"
]] || [[
"
$wmtheme
"
==
"1"
]]; then
if [[ -z
"
$wmtheme
"
||
"
$wmtheme
"
==
"1"
]]; then
wmtheme=
"Blue"
wmtheme=
"Blue"
else
else
wmtheme=
"Graphite"
wmtheme=
"Graphite"
...
@@ -748,7 +749,7 @@ getcpu() {
...
@@ -748,7 +749,7 @@ getcpu() {
fi
fi
# Get cpu temp
# Get cpu temp
if [[
"
$cpu_temp
"
==
"on"
]] && [[
-f
"
$temp_dir
"
]]; then
if [[
"
$cpu_temp
"
==
"on"
&&
-f
"
$temp_dir
"
]]; then
temp=
"
$(
<
"
$temp_dir
"
)
"
temp=
"
$(
<
"
$temp_dir
"
)
"
temp=
"
$((
temp
*
100
/
10000
))
"
temp=
"
$((
temp
*
100
/
10000
))
"
temp=
"[
${
temp
/
${
temp
:
-1
}}
.
${
temp
:
-1
}
°C]"
temp=
"[
${
temp
/
${
temp
:
-1
}}
.
${
temp
:
-1
}
°C]"
...
@@ -871,7 +872,7 @@ getcpu() {
...
@@ -871,7 +872,7 @@ getcpu() {
cpu=
"
${
cpu
//with Radeon HD Graphics
}
"
cpu=
"
${
cpu
//with Radeon HD Graphics
}
"
# Add cpu cores to output
# Add cpu cores to output
[[
"
$cpu_cores
"
!=
"off"
]] && [[
"
$cores
"
]] && \
[[
"
$cpu_cores
"
!=
"off"
&&
"
$cores
"
]] && \
cpu=
"
${
cpu
/@/(
${
cores
}
) @
}
"
cpu=
"
${
cpu
/@/(
${
cores
}
) @
}
"
# Remove speed from output
# Remove speed from output
...
@@ -1343,7 +1344,7 @@ getstyle() {
...
@@ -1343,7 +1344,7 @@ getstyle() {
;;
;;
esac
esac
if [[ -n "
$DISPLAY
"
]] && [[
"
$os
" != "
Mac OS X
" ]]; then
if [[ -n "
$DISPLAY
"
&&
"
$os
" != "
Mac OS X
" ]]; then
# Get DE if user has disabled the function.
# Get DE if user has disabled the function.
[[ -z "
$de
" ]] && getde
[[ -z "
$de
" ]] && getde
...
@@ -1445,11 +1446,11 @@ getstyle() {
...
@@ -1445,11 +1446,11 @@ getstyle() {
gtk3theme="
$(
trim
"
$gtk3theme
"
)
"
gtk3theme="
$(
trim
"
$gtk3theme
"
)
"
# Format the string based on which themes exist
# Format the string based on which themes exist
if [[ "
$gtk2theme
"
]] && [[
"
$gtk2theme
" == "
$gtk3theme
" ]]; then
if [[ "
$gtk2theme
"
&&
"
$gtk2theme
" == "
$gtk3theme
" ]]; then
gtk3theme+="
[GTK2/3]
"
gtk3theme+="
[GTK2/3]
"
unset gtk2theme
unset gtk2theme
elif [[ "
$gtk2theme
"
]] && [[
"
$gtk3theme
" ]]; then
elif [[ "
$gtk2theme
"
&&
"
$gtk3theme
" ]]; then
gtk2theme+="
[GTK2],
"
gtk2theme+="
[GTK2],
"
gtk3theme+="
[GTK3]
"
gtk3theme+="
[GTK3]
"
else
else
...
@@ -1961,7 +1962,7 @@ getwallpaper() {
...
@@ -1961,7 +1962,7 @@ getwallpaper() {
# Ascii {{{
# Ascii {{{
getascii() {
getascii() {
if [[ ! -f "
$ascii
"
]] || [[
"
$ascii
" == "
distro
" ]]; then
if [[ ! -f "
$ascii
"
||
"
$ascii
" == "
distro
" ]]; then
# Error message
# Error message
[[ "
$ascii
" != "
distro
" ]] &&
\
[[ "
$ascii
" != "
distro
" ]] &&
\
[[ ! -f "
$ascii
" ]] && err "
Ascii: Ascii file not found, using distro ascii
"
[[ ! -f "
$ascii
" ]] && err "
Ascii: Ascii file not found, using distro ascii
"
...
@@ -2081,7 +2082,7 @@ getimage() {
...
@@ -2081,7 +2082,7 @@ getimage() {
fi
fi
# Get terminal width and height if
\0
33[14t is unsupported.
# Get terminal width and height if
\0
33[14t is unsupported.
if [[ "
${#
term_size
}
" -le 5
]] && [[
"
$image_backend
" != "
tycat
" ]]; then
if [[ "
${#
term_size
}
" -le 5
&&
"
$image_backend
" != "
tycat
" ]]; then
if type -p xdotool >/dev/null 2>&1 &&
\
if type -p xdotool >/dev/null 2>&1 &&
\
[[ "
$image_backend
" != "
iterm2
" ]]; then
[[ "
$image_backend
" != "
iterm2
" ]]; then
...
@@ -2108,7 +2109,7 @@ getimage() {
...
@@ -2108,7 +2109,7 @@ getimage() {
fi
fi
# If
$img
isn't a file fallback to ascii mode.
# If
$img
isn't a file fallback to ascii mode.
if [[ ! -f "
$img
"
]] || [[ -z "
$term_width
" ]] || [[
"
$term_width
" -le 10 ]]; then
if [[ ! -f "
$img
"
|| -z "
$term_width
" ||
"
$term_width
" -le 10 ]]; then
image="
ascii
"
image="
ascii
"
getascii
getascii
...
@@ -2395,7 +2396,7 @@ info() {
...
@@ -2395,7 +2396,7 @@ info() {
# Fix rendering issues with w3m and lines that
# Fix rendering issues with w3m and lines that
# wrap to the next line by adding a max line
# wrap to the next line by adding a max line
# length.
# length.
if
[[
"
$image
"
!=
"off"
]]
&&
[[
"
$image
"
!=
"ascii"
]]
&&
[[
"
$1
"
!=
"cols"
]]
;
then
if
[[
"
$image
"
!=
"off"
&&
"
$image
"
!=
"ascii"
&&
"
$1
"
!=
"cols"
]]
;
then
padding_num
=
"
${
padding
/\\033\[
}
"
padding_num
=
"
${
padding
/\\033\[
}
"
output
=
"
$(
printf
"%.
$((
columns
-
${
padding_num
/C
}
-
gap
-
${#
subtitle
}))
s"
"
$output
"
)
"
output
=
"
$(
printf
"%.
$((
columns
-
${
padding_num
/C
}
-
gap
-
${#
subtitle
}))
s"
"
$output
"
)
"
fi
fi
...
@@ -2427,7 +2428,7 @@ prin() {
...
@@ -2427,7 +2428,7 @@ prin() {
# Fix rendering issues with w3m and lines that
# Fix rendering issues with w3m and lines that
# wrap to the next line by adding a max line
# wrap to the next line by adding a max line
# length.
# length.
if
[[
"
$image
"
!=
"off"
]]
&&
[[
"
$image
"
!=
"ascii"
]]
;
then
if
[[
"
$image
"
!=
"off"
&&
"
$image
"
!=
"ascii"
]]
;
then
padding_num
=
"
${
padding
/\\033\[
}
"
padding_num
=
"
${
padding
/\\033\[
}
"
string
=
"
$(
printf
"%.
$((
columns
-
${
padding_num
/C
}
-
gap
))
s"
"
$string
"
)
"
string
=
"
$(
printf
"%.
$((
columns
-
${
padding_num
/C
}
-
gap
))
s"
"
$string
"
)
"
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment