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
d707df39
Commit
d707df39
authored
Jun 12, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quote all the things
parent
3b00bf83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
333 additions
and
333 deletions
+333
-333
neofetch
neofetch
+333
-333
No files found.
neofetch
View file @
d707df39
...
@@ -480,14 +480,14 @@ getdistro () {
...
@@ -480,14 +480,14 @@ getdistro () {
"Linux"
)
"Linux"
)
if
type
-p
lsb_release
>
/dev/null 2>&1
;
then
if
type
-p
lsb_release
>
/dev/null 2>&1
;
then
distro
=
"
$(
lsb_release
-d
2>/dev/null |
awk
-F
':'
'/Description/ {printf $2}'
)
"
distro
=
"
$(
lsb_release
-d
2>/dev/null |
awk
-F
':'
'/Description/ {printf $2}'
)
"
distro
=
${
distro
/[[
:space:]]
}
distro
=
"
${
distro
/[[
:space:]]
}
"
elif
type
-p
crux
>
/dev/null 2>&1
;
then
elif
type
-p
crux
>
/dev/null 2>&1
;
then
distro
=
"
$(
crux
)
"
distro
=
"
$(
crux
)
"
else
else
distro
=
"
$(
awk
-F
'NAME='
'/^NAME=/ {printf $2}'
/etc/
*
ease
)
"
distro
=
"
$(
awk
-F
'NAME='
'/^NAME=/ {printf $2}'
/etc/
*
ease
)
"
distro
=
${
distro
//\
"}
distro
=
"
${
distro
//\
"}"
# Workaround for distros that store the value differently.
# Workaround for distros that store the value differently.
[ -z
"
$distro
"
] && distro=
"
$(
awk
-F
'TAILS_PRODUCT_NAME="|"'
'/^TAILS_PRODUCT_NAME=/ {printf $2}'
/etc/
*
ease
)
"
[ -z
"
$distro
"
] && distro=
"
$(
awk
-F
'TAILS_PRODUCT_NAME="|"'
'/^TAILS_PRODUCT_NAME=/ {printf $2}'
/etc/
*
ease
)
"
...
@@ -496,8 +496,8 @@ getdistro () {
...
@@ -496,8 +496,8 @@ getdistro () {
;;
;;
"Mac OS X"
)
"Mac OS X"
)
osx_version=
$(
sw_vers
-productVersion
)
osx_version=
"
$(
sw_vers
-productVersion
)
"
osx_build=
$(
sw_vers
-buildVersion
)
osx_build=
"
$(
sw_vers
-buildVersion
)
"
case
"
${
osx_version
%.*
}
"
in
case
"
${
osx_version
%.*
}
"
in
"10.4"
) codename=
"Mac OS X Tiger"
;;
"10.4"
) codename=
"Mac OS X Tiger"
;;
...
@@ -522,7 +522,7 @@ getdistro () {
...
@@ -522,7 +522,7 @@ getdistro () {
"BSD")
"BSD")
distro="$(uname -s)"
distro="$(uname -s)"
distro=
${
distro
/DragonFly/DragonFlyBSD
}
distro=
"${distro/DragonFly/DragonFlyBSD}"
# Workaround for PCBSD as uname still displays FreeBSD.
# Workaround for PCBSD as uname still displays FreeBSD.
[ -f "/etc/pcbsd-lang" ] && distro="PCBSD"
[ -f "/etc/pcbsd-lang" ] && distro="PCBSD"
...
@@ -532,23 +532,23 @@ getdistro () {
...
@@ -532,23 +532,23 @@ getdistro () {
distro="$(wmic os get Caption /value)"
distro="$(wmic os get Caption /value)"
# Strip crap from the output of wmic
# Strip crap from the output of wmic
distro=
${
distro
/Caption
'='
}
distro=
"${distro/Caption'
=
'}"
distro=
${
distro
//[[
:space:]]/
}
distro=
"${distro//[[:space:]]/ }"
distro=
${
distro
//
}
distro=
"${distro// }"
distro=
${
distro
/Microsoft
}
distro=
"${distro/Microsoft }"
;;
;;
esac
esac
distro=
${
distro
//+( )/
}
distro=
"${distro//+( )/ }"
# Get architecture
# Get architecture
[ "$os_arch" == "on" ] && \
[ "$os_arch" == "on" ] && \
distro+=" $(uname -m)"
distro+=" $(uname -m)"
[ "$osx_codename" == "off" ] && \
[ "$osx_codename" == "off" ] && \
distro=
${
distro
/
${
codename
}
/Mac OS X
}
distro=
"${distro/${codename}/Mac OS X}"
[ "$osx_buildversion" == "off" ] && \
[ "$osx_buildversion" == "off" ] && \
distro=
${
distro
/
${
osx_build
}}
distro=
"${distro/ ${osx_build}}"
}
}
...
@@ -580,11 +580,11 @@ getuptime () {
...
@@ -580,11 +580,11 @@ getuptime () {
"Linux" | "Windows")
"Linux" | "Windows")
case "$distro" in
case "$distro" in
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "Windows"*)
uptime=
$(
uptime
|
awk
-F
':[0-9]{2}+ |(, ){1}+'
'{printf $2}'
)
uptime=
"$(uptime | awk -F '
:[0-9]
{2
}
+ |(, ){1}+' '{printf
$2
}')"
;;
;;
"openSUSE"
*
)
"openSUSE"
*
)
uptime=
$(
uptime
|
awk
-F
':[0-9]{2}+[a-z][a-z] |(, ){1}+'
'{printf $2}'
)
uptime
=
"
$(
uptime
|
awk
-F
':[0-9]{2}+[a-z][a-z] |(, ){1}+'
'{printf $2}'
)
"
;;
;;
*
)
*
)
...
@@ -598,16 +598,16 @@ getuptime () {
...
@@ -598,16 +598,16 @@ getuptime () {
# Get boot time in seconds
# Get boot time in seconds
boot
=
"
$(
sysctl
-n
kern.boottime
)
"
boot
=
"
$(
sysctl
-n
kern.boottime
)
"
boot
=
"
${
boot
/
'{ sec = '
}
"
boot
=
"
${
boot
/
'{ sec = '
}
"
boot=
${
boot
/,*
}
boot
=
"
${
boot
/,*
}
"
# Get current date in seconds
# Get current date in seconds
now=
$(
date
+%s
)
now
=
"
$(
date
+%s
)
"
uptime=
$((
now
-
boot
))
uptime
=
"
$((
now
-
boot
))
"
# Convert uptime to days/hours/mins
# Convert uptime to days/hours/mins
minutes=
$((
uptime
/
60
%
60
))
minutes
=
"
$((
uptime
/
60
%
60
))
"
hours=
$((
uptime
/
3600
%
24
))
hours
=
"
$((
uptime
/
3600
%
24
))
"
days=
$((
uptime
/
86400
))
days
=
"
$((
uptime
/
86400
))
"
case
"
$minutes
"
in
case
"
$minutes
"
in
1
)
minutes
=
"1 minute"
;;
1
)
minutes
=
"1 minute"
;;
...
@@ -642,27 +642,27 @@ getuptime () {
...
@@ -642,27 +642,27 @@ getuptime () {
# Make the output of uptime smaller.
# Make the output of uptime smaller.
case
"
$uptime_shorthand
"
in
case
"
$uptime_shorthand
"
in
"on"
)
"on"
)
uptime=
${
uptime
/up
}
uptime
=
"
${
uptime
/up
}
"
uptime=
${
uptime
/minutes/mins
}
uptime
=
"
${
uptime
/minutes/mins
}
"
uptime=
${
uptime
/minute/min
}
uptime
=
"
${
uptime
/minute/min
}
"
uptime=
${
uptime
/seconds/secs
}
uptime
=
"
${
uptime
/seconds/secs
}
"
uptime=
${
uptime
#
}
uptime
=
"
${
uptime
#
}
"
;;
;;
"tiny"
)
"tiny"
)
uptime=
${
uptime
/up
}
uptime
=
"
${
uptime
/up
}
"
uptime=
${
uptime
/ days/d
}
uptime
=
"
${
uptime
/ days/d
}
"
uptime=
${
uptime
/ day/d
}
uptime
=
"
${
uptime
/ day/d
}
"
uptime=
${
uptime
/ hours/h
}
uptime
=
"
${
uptime
/ hours/h
}
"
uptime=
${
uptime
/ hour/h
}
uptime
=
"
${
uptime
/ hour/h
}
"
uptime=
${
uptime
/ minutes/m
}
uptime
=
"
${
uptime
/ minutes/m
}
"
uptime=
${
uptime
/ minute/m
}
uptime
=
"
${
uptime
/ minute/m
}
"
uptime=
${
uptime
/ seconds/s
}
uptime
=
"
${
uptime
/ seconds/s
}
"
uptime=
${
uptime
/,
}
uptime
=
"
${
uptime
/,
}
"
uptime=
${
uptime
#
}
uptime
=
"
${
uptime
#
}
"
;;
;;
esac
esac
uptime=
${
uptime
//+( )/
}
uptime
=
"
${
uptime
//+( )/
}
"
}
}
# }}}
# }}}
...
@@ -676,74 +676,74 @@ getpackages () {
...
@@ -676,74 +676,74 @@ getpackages () {
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 2>&1
&&
\
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 2>&1
&&
\
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 2>&1
&&
\
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 2>&1
&&
\
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 2>&1
&&
\
packages
=
$((
packages+
=
$(
pkginfo
-i
|
wc
-l
)))
packages
=
"
$((
packages+
=
"
$(
pkginfo
-i
|
wc
-l
)
"
))
"
type
-p
pisi
>
/dev/null 2>&1
&&
\
type
-p
pisi
>
/dev/null 2>&1
&&
\
packages
=
$((
packages+
=
$(
pisi list-installed |
wc
-l
)))
packages
=
"
$((
packages+
=
"
$(
pisi list-installed |
wc
-l
)
"
))
"
type
-p
pkg
>
/dev/null 2>&1
&&
\
type
-p
pkg
>
/dev/null 2>&1
&&
\
packages
=
$((
packages+
=
$(
ls
-1
/var/db/pkg |
wc
-l
)))
packages
=
"
$((
packages+
=
"
$(
ls
-1
/var/db/pkg |
wc
-l
)
"
))
"
type
-p
emerge
>
/dev/null 2>&1
&&
\
type
-p
emerge
>
/dev/null 2>&1
&&
\
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 2>&1
&&
\
packages
=
$((
packages+
=
$(
ls
-d
-1
/nix/store/
*
/ |
wc
-l
)))
packages
=
"
$((
packages+
=
"
$(
ls
-d
-1
/nix/store/
*
/ |
wc
-l
)
"
))
"
type
-p
apk
>
/dev/null 2>&1
&&
\
type
-p
apk
>
/dev/null 2>&1
&&
\
packages
=
$((
packages+
=
$(
apk info |
wc
-l
)))
packages
=
"
$((
packages+
=
"
$(
apk info |
wc
-l
)
"
))
"
type
-p
pacman-g2
>
/dev/null 2>&1
&&
\
type
-p
pacman-g2
>
/dev/null 2>&1
&&
\
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 2>&1
&&
\
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
)
"
))
"
;;
;;
"Mac OS X"
)
"Mac OS X"
)
[ -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 2>&1 &&
\
packages
=
$((
packages
+
$(
port installed 2>/dev/null |
wc
-l
)
-
1
))
packages=
"
$((
packages
+
:
$(
port installed 2>/dev/null |
wc
-l
)
-
1
))
"
type -p brew >/dev/null 2>&1 &&
\
type -p brew >/dev/null 2>&1 &&
\
packages
=
$((
packages
+
$(
find /usr/local/Cellar
-maxdepth
1 2>/dev/null |
wc
-l
)
-
1
))
packages=
"
$((
packages
+
"
$(
find /usr/local/Cellar
-maxdepth
1 2>/dev/null |
wc
-l
)
"
-
1
))
"
type -p pkgin >/dev/null 2>&1 &&
\
type -p pkgin >/dev/null 2>&1 &&
\
packages
=
$((
packages
+
$(
pkgin list 2>/dev/null |
wc
-l
)))
packages=
"
$((
packages
+
"
$(
pkgin list 2>/dev/null |
wc
-l
)
"
))
"
;;
;;
"
BSD
")
"
BSD
")
if type -p pkg_info >/dev/null 2>&1; then
if type -p pkg_info >/dev/null 2>&1; 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 2>&1; then
packages
=
$(
pkg info |
wc
-l
)
packages=
"
$(
pkg info |
wc
-l
)
"
fi
fi
;;
;;
"
Windows
")
"
Windows
")
packages
=
$(
cygcheck
-cd
|
wc
-l
)
packages=
"
$(
cygcheck
-cd
|
wc
-l
)
"
# Count chocolatey packages
# Count chocolatey packages
[ -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
)
"
))
"
;;
;;
esac
esac
packages
=
${
packages
//
}
packages=
"
${
packages
//
}
"
}
}
# }}}
# }}}
...
@@ -761,23 +761,23 @@ getshell () {
...
@@ -761,23 +761,23 @@ getshell () {
case "
$shell
" in
case "
$shell
" in
*"
bash
"*)
*"
bash
"*)
shell+="
$(
bash
--version
|
head
-n
1
)
"
shell+="
$(
bash
--version
|
head
-n
1
)
"
shell
=
${
shell
/ *, version
}
shell=
"
${
shell
/ *, version
}
"
;;
;;
*"
zsh
"*)
*"
zsh
"*)
shell+="
$(
zsh
--version
)
"
shell+="
$(
zsh
--version
)
"
shell
=
${
shell
/ zsh
}
shell=
"
${
shell
/ zsh
}
"
;;
;;
*"
mksh
"* | *"
ksh
")
*"
mksh
"* | *"
ksh
")
shell+="
$(
"
$SHELL
"
-c
'printf "%s" "$KSH_VERSION"'
)
"
shell+="
$(
"
$SHELL
"
-c
'printf "%s" "$KSH_VERSION"'
)
"
shell
=
${
shell
/ * KSH
}
shell=
"
${
shell
/ * KSH
}
"
;;
;;
*"
tcsh
"* | *"
csh
"*)
*"
tcsh
"* | *"
csh
"*)
shell+="
$(
"
$SHELL
"
--version
)
"
shell+="
$(
"
$SHELL
"
--version
)
"
shell
=
${
shell
/tcsh
}
shell=
"
${
shell
/tcsh
}
"
shell
=
${
shell
/\(*
}
shell=
"
${
shell
/\(*
}
"
;;
;;
*"
fish
"*)
*"
fish
"*)
...
@@ -797,7 +797,7 @@ getde () {
...
@@ -797,7 +797,7 @@ getde () {
"
Mac OS X
") de="
Aqua
" ;;
"
Mac OS X
") de="
Aqua
" ;;
*)
*)
de="
${
XDG_CURRENT_DESKTOP
/i3
}
"
de="
${
XDG_CURRENT_DESKTOP
/i3
}
"
de
=
${
de
/
'X-'
}
de=
"
${
de
/
'X-'
}
"
;;
;;
esac
esac
...
@@ -822,15 +822,15 @@ getwm () {
...
@@ -822,15 +822,15 @@ 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}'
2>/dev/null
)
"
wm="
$(
xprop
-id
"
$id
"
-notype
-f
_NET_WM_NAME 8t 2>/dev/null
)
"
wm="
$(
xprop
-id
"
$id
"
-notype
-f
_NET_WM_NAME 8t 2>/dev/null
)
"
wm
=
${
wm
/*_NET_WM_NAME =
}
wm=
"
${
wm
/*_NET_WM_NAME =
}
"
wm
=
${
wm
/\
"}
wm=
"
${
wm
/\
"}"
wm=
${
wm
/\
"*}
wm=
"
${
wm
/\
"*}"
# Fallback for Wayland wms
# Fallback for Wayland wms
case
"
$wm
"
in
case
"
$wm
"
in
"xwlc"
)
"xwlc"
)
wm=
"
$(
ps
-e
|
grep
-m
1
-oE
"sway|orbment|velox|orbital"
)
"
wm=
"
$(
ps
-e
|
grep
-m
1
-oE
"sway|orbment|velox|orbital"
)
"
[ "
$version
" -ge 4 ] && wm=
${
wm
^
}
[
"
$version
"
-ge 4 ] && wm=
"
${
wm
^
}
"
;;
;;
esac
esac
...
@@ -882,8 +882,8 @@ getwmtheme () {
...
@@ -882,8 +882,8 @@ getwmtheme () {
'E17' | 'Enlightenment')
'E17' | 'Enlightenment')
if type -p eet >/dev/null 2>&1; then
if type -p eet >/dev/null 2>&1; 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
%.*
}
"
fi
fi
;;
;;
...
@@ -920,7 +920,7 @@ getwmtheme () {
...
@@ -920,7 +920,7 @@ getwmtheme () {
'KWin'*)
'KWin'*)
kdeconfigdir
kdeconfigdir
kde_config_dir=
${
kde_config_dir
%/
}
kde_config_dir=
"
${
kde_config_dir
%/
}
"
if [ -f "
$kde_config_dir
/share/config/kwinrc
" ]; then
if [ -f "
$kde_config_dir
/share/config/kwinrc
" ]; then
wmtheme="
$(
awk
'/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0); print $0; exit}'
"
$kde_config_dir
/share/config/kwinrc"
)
"
wmtheme="
$(
awk
'/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0); print $0; exit}'
"
$kde_config_dir
/share/config/kwinrc"
)
"
...
@@ -931,7 +931,7 @@ getwmtheme () {
...
@@ -931,7 +931,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
...
@@ -951,7 +951,7 @@ getwmtheme () {
...
@@ -951,7 +951,7 @@ getwmtheme () {
esac
esac
wmtheme="
${
wmtheme
//\
'}"
wmtheme="
${
wmtheme
//\
'}"
[ "$version" -ge 4 ] && wmtheme=
${wmtheme^}
[ "$version" -ge 4 ] && wmtheme=
"${wmtheme^}"
}
}
# }}}
# }}}
...
@@ -986,19 +986,19 @@ getcpu () {
...
@@ -986,19 +986,19 @@ getcpu () {
read -t 1 -r speed < \
read -t 1 -r speed < \
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
/sys/devices/system/cpu/cpu0/cpufreq/${speed_type}
speed=
$((speed / 100000))
speed=
"$((speed / 100000))"
else
else
speed=
$(awk -F '
:
|\\.
' '
/cpu MHz/ {printf
$2
; exit
}
' /proc/cpuinfo)
speed=
"$(awk -F '
:
|\\.
' '
/cpu MHz/ {printf
$2
; exit
}
' /proc/cpuinfo)"
speed=
$((
speed
/
100
))
speed=
"$((speed / 100))"
fi
fi
cores=
$(
awk
-F
': '
'/siblings/ {printf $2; exit}'
/proc/cpuinfo
)
cores=
"$(awk -F '
:
' '
/
siblings/
{
printf
$2
;
exit
}
' /proc/cpuinfo)"
# Fix for speeds under 1ghz
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
if [ -z "${speed:1}" ]; then
speed="0.${speed}"
speed="0.${speed}"
else
else
speed=
${
speed
:0:1
}
.
${
speed
:1
}
speed=
"${speed:0:1}.${speed:1}"
fi
fi
cpu="$cpu @ ${speed}GHz"
cpu="$cpu @ ${speed}GHz"
...
@@ -1006,11 +1006,11 @@ getcpu () {
...
@@ -1006,11 +1006,11 @@ getcpu () {
"Mac OS X")
"Mac OS X")
cpu="$(sysctl -n machdep.cpu.brand_string)"
cpu="$(sysctl -n machdep.cpu.brand_string)"
cores=
$(
sysctl
-n
hw.ncpu
)
cores=
"$(sysctl -n hw.ncpu)"
;;
;;
"iPhone OS")
"iPhone OS")
ios_model=
${
ios_model
:-$(
uname
-m
)}
ios_model=
"${ios_model:-$(uname -m)}"
case "$ios_model" in
case "$ios_model" in
"iPhone1,1" | "iPhone1,2" | "iPod1,1")
"iPhone1,1" | "iPhone1,2" | "iPod1,1")
cpu="Samsung S5L8900 @ 412MHz"
cpu="Samsung S5L8900 @ 412MHz"
...
@@ -1122,22 +1122,22 @@ getcpu () {
...
@@ -1122,22 +1122,22 @@ getcpu () {
"BSD")
"BSD")
# Get cpu name
# Get cpu name
cpu="$(sysctl -n hw.model)"
cpu="$(sysctl -n hw.model)"
cpu=
${
cpu
/[0-9]\.*
}
cpu=
"${cpu/[0-9]\.*}"
cpu=
${
cpu
/ @*
}
cpu=
"${cpu/ @*}"
# Get cpu speed
# Get cpu speed
speed=
$(
sysctl
-n
hw.cpuspeed
)
speed=
"$(sysctl -n hw.cpuspeed)"
[ -z "
$speed
" ] && speed=
$(
sysctl
-n
hw.clockrate
)
[ -z "$speed" ] && speed=
"$(sysctl -n hw.clockrate)"
speed=
$((
speed
/
100
))
speed=
"$((speed / 100))"
# Get cpu cores
# Get cpu cores
cores=
$(
sysctl
-n
hw.ncpu
)
cores=
"$(sysctl -n hw.ncpu)"
# Fix for speeds under 1ghz
# Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then
if [ -z "${speed:1}" ]; then
speed="0.${speed}"
speed="0.${speed}"
else
else
speed=
${
speed
:0:1
}
.
${
speed
:1
}
speed=
"${speed:0:1}.${speed:1}"
fi
fi
cpu="$cpu @ ${speed}GHz"
cpu="$cpu @ ${speed}GHz"
...
@@ -1147,41 +1147,41 @@ getcpu () {
...
@@ -1147,41 +1147,41 @@ getcpu () {
# Remove uneeded patterns from cpu output
# Remove uneeded patterns from cpu output
# This is faster than sed/gsub
# This is faster than sed/gsub
cpu=
${
cpu
//(tm)
}
cpu=
"${cpu//(tm)}"
cpu=
${
cpu
//(TM)
}
cpu=
"${cpu//(TM)}"
cpu=
${
cpu
//(r)
}
cpu=
"${cpu//(r)}"
cpu=
${
cpu
//(R)
}
cpu=
"${cpu//(R)}"
cpu=
${
cpu
//CPU
}
cpu=
"${cpu//CPU}"
cpu=
${
cpu
//Processor
}
cpu=
"${cpu//Processor}"
cpu=
${
cpu
//Six-Core
}
cpu=
"${cpu//Six-Core}"
cpu=
${
cpu
//Eight-Core
}
cpu=
"${cpu//Eight-Core}"
cpu=
${
cpu
//Dual-Core
}
cpu=
"${cpu//Dual-Core}"
cpu=
${
cpu
//Quad-Core
}
cpu=
"${cpu//Quad-Core}"
cpu=
${
cpu
//with Radeon HD Graphics
}
cpu=
"${cpu//with Radeon HD Graphics}"
# Add cpu cores to output
# Add cpu cores to output
[ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \
[ "$cpu_cores" == "on" ] && [ ! -z "$cores" ] && \
cpu=
${
cpu
/@/\(
${
cores
}
\) @
}
cpu=
"${cpu/@/\(${cores}\) @}"
# Make the output of cpu shorter
# Make the output of cpu shorter
case "$cpu_shorthand" in
case "$cpu_shorthand" in
"
name
") cpu=
${
cpu
/@*
}
;;
"name") cpu=
"${cpu/@*}"
;;
"
speed
") cpu=
${
cpu
#*@
}
;;
"speed") cpu=
"${cpu#*@ }"
;;
"on" | "tiny")
"on" | "tiny")
cpu=
${
cpu
/Intel
}
cpu=
"${cpu/Intel }"
cpu=
${
cpu
/Core
}
cpu=
"${cpu/Core }"
cpu=
${
cpu
/Core? Duo
}
cpu=
"${cpu/Core? Duo }"
cpu=
${
cpu
/AMD
}
cpu=
"${cpu/AMD }"
case "$cpu_shorthand" in
case "$cpu_shorthand" in
"
tiny
") cpu=
${
cpu
/@*
}
;;
"tiny") cpu=
"${cpu/@*}"
;;
esac
esac
;;
;;
esac
esac
# Trim whitespace
# Trim whitespace
cpu=
${
cpu
//+( )/
}
cpu=
"${cpu//+( )/ }"
[ ! -z "$cpu" ] && prin "$subtitle" "$cpu"
[ ! -z "$cpu" ] && prin "$subtitle" "$cpu"
...
@@ -1213,13 +1213,13 @@ getgpu () {
...
@@ -1213,13 +1213,13 @@ getgpu () {
[
-
z
"
$gpu
"
]
&&
\
[
-
z
"
$gpu
"
]
&&
\
gpu
=
"
$(
PATH
=
"/sbin:
$PATH
"
lspci |
grep
-F
"VGA"
)
"
gpu
=
"
$(
PATH
=
"/sbin:
$PATH
"
lspci |
grep
-F
"VGA"
)
"
gpu=
${
gpu
//??
':'
??
'.'
?
}
gpu
=
"
${
gpu
//??
':'
??
'.'
?
}
"
# Count the number of GPUs
# Count the number of GPUs
count
=
"
$(
printf
"%s"
"
$gpu
"
|
uniq
-c
)
"
count
=
"
$(
printf
"%s"
"
$gpu
"
|
uniq
-c
)
"
count=
${
count
/ VGA*
}
count
=
"
${
count
/ VGA*
}
"
count=
${
count
/ 3D*
}
count
=
"
${
count
/ 3D*
}
"
count=
${
count
//[[
:space:]]
}
count
=
"
${
count
//[[
:space:]]
}
"
# If there's more than one gpu
# If there's more than one gpu
# Display the count.
# Display the count.
...
@@ -1230,9 +1230,9 @@ getgpu () {
...
@@ -1230,9 +1230,9 @@ getgpu () {
fi
fi
# Format the output
# Format the output
gpu=
${
gpu
/* VGA compatible controller
:
}
gpu
=
"
${
gpu
/* VGA compatible controller
:
}
"
gpu=
${
gpu
/* 3D controller
:
}
gpu
=
"
${
gpu
/* 3D controller
:
}
"
gpu=
${
gpu
/(rev*)
}
gpu
=
"
${
gpu
/(rev*)
}
"
case
"
$gpu
"
in
case
"
$gpu
"
in
intel
*
)
intel
*
)
...
@@ -1240,36 +1240,36 @@ getgpu () {
...
@@ -1240,36 +1240,36 @@ getgpu () {
;;
;;
advanced
*
)
advanced
*
)
gpu=
${
gpu
/Advanced Micro Devices, Inc\.
}
gpu
=
"
${
gpu
/Advanced Micro Devices, Inc\.
}
"
gpu=
${
gpu
/
'[AMD/ATI]'
}
gpu
=
"
${
gpu
/
'[AMD/ATI]'
}
"
gpu=
${
gpu
/Tahiti PRO
}
gpu
=
"
${
gpu
/Tahiti PRO
}
"
gpu=
${
gpu
/Seymour
}
gpu
=
"
${
gpu
/Seymour
}
"
gpu=
${
gpu
/Cayman
}
gpu
=
"
${
gpu
/Cayman
}
"
gpu=
${
gpu
/Richland
}
gpu
=
"
${
gpu
/Richland
}
"
gpu=
${
gpu
/Pitcairn
}
gpu
=
"
${
gpu
/Pitcairn
}
"
gpu=
${
gpu
/Broadway
}
gpu
=
"
${
gpu
/Broadway
}
"
gpu=
${
gpu
/XTMobility
}
gpu
=
"
${
gpu
/XTMobility
}
"
gpu=
${
gpu
/Mobility
}
gpu
=
"
${
gpu
/Mobility
}
"
gpu=
${
gpu
/Hawaii
}
gpu
=
"
${
gpu
/Hawaii
}
"
gpu=
${
gpu
/Tobago
}
gpu
=
"
${
gpu
/Tobago
}
"
gpu=
${
gpu
/Thames
}
gpu
=
"
${
gpu
/Thames
}
"
gpu=
${
gpu
/Kabini
}
gpu
=
"
${
gpu
/Kabini
}
"
gpu=
${
gpu
/Bonaire
}
gpu
=
"
${
gpu
/Bonaire
}
"
gpu=
${
gpu
/XTX
}
gpu
=
"
${
gpu
/XTX
}
"
gpu=
${
gpu
/ OEM
}
gpu
=
"
${
gpu
/ OEM
}
"
gpu=
${
gpu
/ Cape Verde
}
gpu
=
"
${
gpu
/ Cape Verde
}
"
gpu=
${
gpu
/ \[
}
gpu
=
"
${
gpu
/ \[
}
"
gpu=
${
gpu
/\]
}
gpu
=
"
${
gpu
/\]
}
"
brand
=
"AMD "
brand
=
"AMD "
;;
;;
nvidia
*
)
nvidia
*
)
gpu=
${
gpu
/NVIDIA Corporation
}
gpu
=
"
${
gpu
/NVIDIA Corporation
}
"
gpu=
${
gpu
/G????M
}
gpu
=
"
${
gpu
/G????M
}
"
gpu=
${
gpu
/G????
}
gpu
=
"
${
gpu
/G????
}
"
gpu=
${
gpu
/\[
}
gpu
=
"
${
gpu
/\[
}
"
gpu=
${
gpu
/\]
}
gpu
=
"
${
gpu
/\]
}
"
brand
=
"NVIDIA "
brand
=
"NVIDIA "
;;
;;
...
@@ -1287,15 +1287,15 @@ getgpu () {
...
@@ -1287,15 +1287,15 @@ getgpu () {
if
[
-
f
"/Library/Caches/neofetch/gpu"
]
;
then
if
[
-
f
"/Library/Caches/neofetch/gpu"
]
;
then
source
"/Library/Caches/neofetch/gpu"
source
"/Library/Caches/neofetch/gpu"
else
else
gpu=
$(
system_profiler SPDisplaysDataType |
awk
-F
': '
'/^\ *Chipset Model:/ {printf $2 ", "}'
)
gpu
=
"
$(
system_profiler SPDisplaysDataType |
awk
-F
': '
'/^\ *Chipset Model:/ {printf $2 ", "}'
)
"
gpu=
${
gpu
//
'/ $'
}
gpu
=
"
${
gpu
//
'/ $'
}
"
gpu=
${
gpu
%,*
}
gpu
=
"
${
gpu
%,*
}
"
cache
"gpu"
"
$gpu
"
"/Library/Caches/"
cache
"gpu"
"
$gpu
"
"/Library/Caches/"
fi
fi
;;
;;
"iPhone OS"
)
"iPhone OS"
)
ios_model=
${
ios_model
:-$(
uname
-m
)}
ios_model
=
"
${
ios_model
:-
"
$(
uname
-m
)
"
}
"
case
"
$ios_model
"
in
case
"
$ios_model
"
in
"iPhone1,1"
|
"iPhone1,2"
)
"iPhone1,1"
|
"iPhone1,2"
)
gpu
=
"PowerVR MBX Lite 3D"
gpu
=
"PowerVR MBX Lite 3D"
...
@@ -1350,50 +1350,50 @@ getgpu () {
...
@@ -1350,50 +1350,50 @@ getgpu () {
"BSD"
)
"BSD"
)
case
"
$distro
"
in
case
"
$distro
"
in
"FreeBSD"
*
)
"FreeBSD"
*
)
gpu=
$(
pciconf
-lv
2>/dev/null |
grep
-B
4
"VGA"
|
grep
"device"
)
gpu
=
"
$(
pciconf
-lv
2>/dev/null |
grep
-B
4
"VGA"
|
grep
"device"
)
"
gpu=
${
gpu
/*device*=
}
gpu
=
"
${
gpu
/*device*=
}
"
gpu=
${
gpu
//\
'}
gpu
=
"
${
gpu
//\
'}"
;;
;;
*)
*)
gpu=
$(glxinfo | grep -F '
OpenGL
renderer string
')
gpu=
"$(glxinfo | grep -F '
OpenGL
renderer string
')"
gpu=
${gpu/'
OpenGL
renderer string
:
'}
gpu=
"${gpu/'
OpenGL
renderer string
:
'}"
;;
;;
esac
esac
;;
;;
"Windows")
"Windows")
gpu=
$(wmic path Win32_VideoController get caption /value)
gpu=
"$(wmic path Win32_VideoController get caption /value)"
gpu=
${gpu/Caption'
=
'}
gpu=
"${gpu/Caption'
=
'}"
gpu=
${gpu//[[:space:]]/ }
gpu=
"${gpu//[[:space:]]/ }"
gpu=
${gpu// }
gpu=
"${gpu// }"
;;
;;
esac
esac
case "$gpu_shorthand" in
case "$gpu_shorthand" in
"on" | "tiny")
"on" | "tiny")
gpu=
${gpu// Rev\. ?}
gpu=
"${gpu// Rev\. ?}"
gpu=
${gpu//AMD*\/ATI\]/AMD}
gpu=
"${gpu//AMD*\/ATI\]/AMD}"
gpu=
${gpu// Tahiti}
gpu=
"${gpu// Tahiti}"
gpu=
${gpu// PRO}
gpu=
"${gpu// PRO}"
gpu=
${gpu// OEM}
gpu=
"${gpu// OEM}"
gpu=
${gpu// Mars}
gpu=
"${gpu// Mars}"
gpu=
${gpu// Series}
gpu=
"${gpu// Series}"
gpu=
${gpu// Controller}
gpu=
"${gpu// Controller}"
gpu=
${gpu/\/*}
gpu=
"${gpu/\/*}"
case "$gpu_shorthand" in
case "$gpu_shorthand" in
"tiny")
"tiny")
gpu=
${gpu/Graphics }
gpu=
"${gpu/Graphics }"
gpu=
${gpu/GeForce }
gpu=
"${gpu/GeForce }"
gpu=
${gpu/Radeon }
gpu=
"${gpu/Radeon }"
;;
;;
esac
esac
;;
;;
esac
esac
gpu=
${gpu//+( )/ }
gpu=
"${gpu//+( )/ }"
gpu="${gpu}${count}"
gpu="${gpu}${count}"
}
}
...
@@ -1406,32 +1406,32 @@ getmemory () {
...
@@ -1406,32 +1406,32 @@ getmemory () {
"Linux" | "Windows")
"Linux" | "Windows")
if grep -F "MemAvail" /proc/meminfo >/dev/null 2>&1; then
if grep -F "MemAvail" /proc/meminfo >/dev/null 2>&1; then
mem=($(awk -F '
:|
kB
' '
/MemTotal|MemAvail/ {printf
$2
}
' /proc/meminfo))
mem=($(awk -F '
:|
kB
' '
/MemTotal|MemAvail/ {printf
$2
}
' /proc/meminfo))
memused=
$((
mem[0]
-
mem[1]
))
memused=
"
$((
mem[0]
-
mem[1]
))
"
else
else
mem=(
$(
awk
-F
':| kB'
'/MemTotal|MemFree|Buffers|Cached/ {printf $2}'
/proc/meminfo
)
0 0)
mem=(
$(
awk
-F
':| kB'
'/MemTotal|MemFree|Buffers|Cached/ {printf $2}'
/proc/meminfo
)
0 0)
memused=
$((
mem[0]
-
mem[1]
-
mem[2]
-
mem[3]
))
memused=
"
$((
mem[0]
-
mem[1]
-
mem[2]
-
mem[3]
))
"
fi
fi
memused=
$((
memused
/
1024
))
memused=
"
$((
memused
/
1024
))
"
memtotal=
$((
mem[0]
/
1024
))
memtotal=
"
$((
mem[0]
/
1024
))
"
;;
;;
"
Mac OS X
" | "
iPhone OS
")
"
Mac OS X
" | "
iPhone OS
")
memtotal=
$(
printf
"scale=0; %s
\n
"
"
$(
sysctl
-n
hw.memsize
)
"
/1024^2 | bc
)
memtotal=
"
$(
printf
"scale=0; %s
\n
"
"
$(
sysctl
-n
hw.memsize
)
"
/1024^2 | bc
)
"
memwired=
$(
vm_stat |
awk
'/wired/ { print $4 }'
)
memwired=
"
$(
vm_stat |
awk
'/wired/ { print $4 }'
)
"
memactive=
$(
vm_stat |
awk
'/active / { printf $3 }'
)
memactive=
"
$(
vm_stat |
awk
'/active / { printf $3 }'
)
"
memcompressed=
$(
vm_stat |
awk
'/occupied/ { printf $5 }'
)
memcompressed=
"
$(
vm_stat |
awk
'/occupied/ { printf $5 }'
)
"
memused=
$((
(
${
memwired
//.
}
+
${
memactive
//.
}
+
${
memcompressed
//.
}
)
*
4
/
1024
))
memused=
"
$((
(
${
memwired
//.
}
+
${
memactive
//.
}
+
${
memcompressed
//.
}
)
*
4
/
1024
))
"
;;
;;
"
BSD
")
"
BSD
")
case "
$distro
" in
case "
$distro
" in
"
NetBSD
"*) memfree=
$(($(
awk
-F
':|kB'
'/MemFree:/ {printf $2}'
/proc/meminfo
)
/
1024
))
;;
"
NetBSD
"*) memfree=
"
$((
"
$(
awk
-F
':|kB'
'/MemFree:/ {printf $2}'
/proc/meminfo
)
"
/
1024
))
"
;;
*) memfree=
$(($(
vmstat |
awk
'END{printf $5}'
)
/
1024
))
;;
*) memfree=
"
$((
"
$(
vmstat |
awk
'END{printf $5}'
)
"
/
1024
))
"
;;
esac
esac
memtotal=
$(($(
sysctl
-n
hw.physmem
)
/
1024
/
1024
))
memtotal=
"
$((
"
$(
sysctl
-n
hw.physmem
)
"
/
1024
/
1024
))
"
memused=
$((
memtotal
-
memfree
))
memused=
"
$((
memtotal
-
memfree
))
"
;;
;;
esac
esac
memory="
${
memused
}
MB /
${
memtotal
}
MB
"
memory="
${
memused
}
MB /
${
memtotal
}
MB
"
...
@@ -1451,14 +1451,14 @@ getmemory () {
...
@@ -1451,14 +1451,14 @@ getmemory () {
getsong () {
getsong () {
if mpc version >/dev/null 2>&1; then
if mpc version >/dev/null 2>&1; then
song="
$(
mpc current 2>/dev/null
)
"
song="
$(
mpc current 2>/dev/null
)
"
state=
$(
mpc |
awk
-F
'\\[|\\]'
'/\[/ {printf $2}'
2>/dev/null
)
state=
"
$(
mpc |
awk
-F
'\\[|\\]'
'/\[/ {printf $2}'
2>/dev/null
)
"
elif [ -n "
$(
ps x |
awk
'!(/awk/) && /cmus/'
)
" ]; then
elif [ -n "
$(
ps x |
awk
'!(/awk/) && /cmus/'
)
" ]; then
IFS=
$'
\n
'
IFS=
$'
\n
'
song=(
$(
cmus-remote
-Q
|
grep
"tag artist
\|
title
\|
status"
2>/dev/null |
sort
)
)
song=(
"
$(
cmus-remote
-Q
|
grep
"tag artist
\|
title
\|
status"
2>/dev/null |
sort
)
"
)
artist=
${
song
[1]/tag artist
}
artist=
"
${
song
[1]/tag artist
}
"
title=
${
song
[2]/tag title
}
title=
"
${
song
[2]/tag title
}
"
state=
${
song
[0]/status
}
state=
"
${
song
[0]/status
}
"
song="
$artist
-
$title
"
song="
$artist
-
$title
"
...
@@ -1476,9 +1476,9 @@ getsong () {
...
@@ -1476,9 +1476,9 @@ getsong () {
awk
-F
'string "'
'/string|array/ {printf "%s",$2; next}{print ""}'
|
\
awk
-F
'string "'
'/string|array/ {printf "%s",$2; next}{print ""}'
|
\
awk
-F
'"'
'/artist|title/ {printf $2 " - "}'
awk
-F
'"'
'/artist|title/ {printf $2 " - "}'
)
"
)
"
song=
${
song
% -
}
song=
"
${
song
% -
}
"
song=
${
song
/
'('
*
}
song=
"
${
song
/
'('
*
}
"
song=
${
song
//
'['
*
}
song=
"
${
song
//
'['
*
}
"
;;
;;
"
Mac OS X
")
"
Mac OS X
")
...
@@ -1512,7 +1512,7 @@ getsong () {
...
@@ -1512,7 +1512,7 @@ getsong () {
# Display Artist and Title on seperate lines.
# Display Artist and Title on seperate lines.
if [ "
$song_shorthand
" == "
on
" ] && [ "
$stdout_mode
" != "
on
" ]; then
if [ "
$song_shorthand
" == "
on
" ] && [ "
$stdout_mode
" != "
on
" ]; then
artist="
${
song
/ -*
}
"
artist="
${
song
/ -*
}
"
song=
${
song
/
$artist
-
}
song=
"
${
song
/
$artist
-
}
"
if [ "
$song
" != "
$artist
" ]; then
if [ "
$song
" != "
$artist
" ]; then
prin "
Artist
" "
$artist
"
prin "
Artist
" "
$artist
"
...
@@ -1533,45 +1533,45 @@ getresolution () {
...
@@ -1533,45 +1533,45 @@ getresolution () {
"
Linux
" | "
BSD
")
"
Linux
" | "
BSD
")
if type -p xrandr >/dev/null 2>&1; then
if type -p xrandr >/dev/null 2>&1; then
case "
$refresh_rate
" in
case "
$refresh_rate
" in
"
on
") resolution=
$(
xrandr
--nograb
--current
|
awk
'match($0,/[0-9]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}'
)
;;
"
on
") resolution=
"
$(
xrandr
--nograb
--current
|
awk
'match($0,/[0-9]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}'
)
"
;;
"
off
") resolution=
$(
xrandr
--nograb
--current
|
awk
'/*/ {printf $1 ", "}'
)
;;
"
off
") resolution=
"
$(
xrandr
--nograb
--current
|
awk
'/*/ {printf $1 ", "}'
)
"
;;
esac
esac
resolution=
${
resolution
//\*
}
resolution=
"
${
resolution
//\*
}
"
elif type -p xdpyinfo >/dev/null 2>&1; then
elif type -p xdpyinfo >/dev/null 2>&1; then
resolution=
$(
xdpyinfo 2>/dev/null |
awk
'/dimensions:/ {printf $2}'
)
resolution=
"
$(
xdpyinfo 2>/dev/null |
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 2>&1; then
resolution=
$(
screenresolution get 2>&1 |
awk
'/Display/ {printf $6 "Hz, "}'
)
resolution=
"
$(
screenresolution get 2>&1 |
awk
'/Display/ {printf $6 "Hz, "}'
)
"
resolution=
${
resolution
//x??@/ @
}
resolution=
"
${
resolution
//x??@/ @
}
"
else
else
resolution=
$(
system_profiler SPDisplaysDataType |
\
resolution=
"
$(
system_profiler SPDisplaysDataType |
\
awk
'/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}'
)
awk
'/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}'
)
"
fi
fi
[[ "
$refresh_rate
" == "
off
" ]] &&
\
[[ "
$refresh_rate
" == "
off
" ]] &&
\
resolution=
${
resolution
// @ *([0-9])Hz
}
resolution=
"
${
resolution
// @ *([0-9])Hz
}
"
;;
;;
"
Windows
")
"
Windows
")
width=
$(
wmic path Win32_VideoController get CurrentHorizontalResolution /value 2>/dev/null
)
width=
"
$(
wmic path Win32_VideoController get CurrentHorizontalResolution /value 2>/dev/null
)
"
width=
${
width
/CurrentHorizontalResolution
'='
/
}
width=
"
${
width
/CurrentHorizontalResolution
'='
/
}
"
width=
${
width
//[[
:space:]]
}
width=
"
${
width
//[[
:space:]]
}
"
height=
$(
wmic path Win32_VideoController get CurrentVerticalResolution /value 2>/dev/null
)
height=
"
$(
wmic path Win32_VideoController get CurrentVerticalResolution /value 2>/dev/null
)
"
height=
${
height
/CurrentVerticalResolution
'='
/
}
height=
"
${
height
/CurrentVerticalResolution
'='
/
}
"
height=
${
height
//[[
:space:]]
}
height=
"
${
height
//[[
:space:]]
}
"
[ ! -z "
$width
" ] &&
\
[ ! -z "
$width
" ] &&
\
resolution="
${
width
}
x
${
height
}
"
resolution="
${
width
}
x
${
height
}
"
;;
;;
esac
esac
resolution=
${
resolution
%,*
}
resolution=
"
${
resolution
%,*
}
"
}
}
# }}}
# }}}
...
@@ -1620,9 +1620,9 @@ getstyle () {
...
@@ -1620,9 +1620,9 @@ getstyle () {
if [ -f "
${
kde_config_dir
}
/share/config/kdeglobals
" ]; then
if [ -f "
${
kde_config_dir
}
/share/config/kdeglobals
" ]; then
kde_config_file="
${
kde_config_dir
}
/share/config/kdeglobals
"
kde_config_file="
${
kde_config_dir
}
/share/config/kdeglobals
"
theme=
$(
grep
"^[^#]*
$kde
"
"
$kde_config_file
"
)
theme=
"
$(
grep
"^[^#]*
$kde
"
"
$kde_config_file
"
)
"
theme=
${
theme
/
${
kde
}
*=
}
theme=
"
${
theme
/
${
kde
}
*=
}
"
[ "
$version
" -ge 4 ] && theme=
${
theme
^
}
[ "
$version
" -ge 4 ] && theme=
"
${
theme
^
}
"
gtk_shorthand="
on
"
gtk_shorthand="
on
"
return
return
...
@@ -1631,75 +1631,75 @@ getstyle () {
...
@@ -1631,75 +1631,75 @@ getstyle () {
*"
Cinnamon
")
*"
Cinnamon
")
if type -p gsettings >/dev/null 2>&1; then
if type -p gsettings >/dev/null 2>&1; then
gtk3theme=
$(
gsettings get org.cinnamon.desktop.interface
$gsettings
)
gtk3theme=
"
$(
gsettings get org.cinnamon.desktop.interface
"
$gsettings
"
)
"
gtk3theme=
${
gtk3theme
//
"'"
}
gtk3theme=
"
${
gtk3theme
//
"'"
}
"
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 2>&1; then
gtk3theme=
$(
gsettings get org.gnome.desktop.interface
$gsettings
)
gtk3theme=
"
$(
gsettings get org.gnome.desktop.interface
"
$gsettings
"
)
"
gtk3theme=
${
gtk3theme
//
"'"
}
gtk3theme=
"
${
gtk3theme
//\
'}"
gtk2theme=
${
gtk3theme
}
gtk2theme=
"${gtk3theme}"
elif type -p gconftool-2 >/dev/null 2>&1; then
elif type -p gconftool-2 >/dev/null 2>&1; then
gtk2theme=
$(
gconftool-2
-g
/desktop/gnome/interface/
$gconf
)
gtk2theme=
"$(gconftool-2 -g /desktop/gnome/interface/"$gconf")"
fi
fi
;;
;;
"Mate"*)
"Mate"*)
gtk3theme=
$(
gsettings get org.mate.interface
$gsettings
)
gtk3theme=
"$(gsettings get org.mate.interface "$gsettings")"
gtk2theme=
${
gtk3theme
}
gtk2theme=
"${gtk3theme}"
;;
;;
"Xfce"*)
"Xfce"*)
type -p xfconf-query >/dev/null 2>&1 && \
type -p xfconf-query >/dev/null 2>&1 && \
gtk2theme=
$(
xfconf-query
-c
xsettings
-p
/Net/
$xfconf
)
gtk2theme=
"$(xfconf-query -c xsettings -p /Net/"$xfconf")"
;;
;;
esac
esac
# Check for gtk2 theme
# Check for gtk2 theme
if [ -z "$gtk2theme" ]; then
if [ -z "$gtk2theme" ]; then
if [ -f "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}" ]; then
if [ -f "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}" ]; then
gtk2theme=
$(
grep
"^[^#]*
$name
"
"
${
GTK2_RC_FILES
:-
$HOME
/.gtkrc-2.0
}
"
)
gtk2theme=
"$(grep "^[^#]*$name" "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}")"
elif [ -f "/usr/share/gtk-2.0/gtkrc" ]; then
elif [ -f "/usr/share/gtk-2.0/gtkrc" ]; then
gtk2theme=
$(
grep
"^[^#]*
$name
"
/usr/share/gtk-2.0/gtkrc
)
gtk2theme=
"$(grep "^[^#]*$name" /usr/share/gtk-2.0/gtkrc)"
elif [ -f "/etc/gtk-2.0/gtkrc" ]; then
elif [ -f "/etc/gtk-2.0/gtkrc" ]; then
gtk2theme=
$(
grep
"^[^#]*
$name
"
/etc/gtk-2.0/gtkrc
)
gtk2theme=
"$(grep "^[^#]*$name" /etc/gtk-2.0/gtkrc)"
fi
fi
gtk2theme=
${
gtk2theme
/
${
name
}
*=
}
gtk2theme=
"${gtk2theme/${name}*=}"
gtk2theme=
${
gtk2theme
//\
"}
gtk2theme=
"${gtk2theme//\"}"
fi
fi
# Check for gtk3 theme
# Check for gtk3 theme
if [ -z "$gtk3theme" ]; then
if [ -z "$gtk3theme" ]; then
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 2>&1; then
gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)"
gtk3theme="$(gsettings get org.gnome.desktop.interface $gsettings)"
gtk3theme=
${
gtk3theme
//\
'}
gtk3theme=
"${gtk3theme//\'
}
"
elif [ -f "
/usr/share/gtk-3.0/settings.ini
" ]; then
elif [ -f "
/usr/share/gtk-3.0/settings.ini
" ]; then
gtk3theme=
$(grep "^[^#]*$name" /usr/share/gtk-3.0/settings.ini)
gtk3theme=
"
$(
grep
"^[^#]*
$name
"
/usr/share/gtk-3.0/settings.ini
)
"
elif [ -f "
/etc/gtk-3.0/settings.ini
" ]; then
elif [ -f "
/etc/gtk-3.0/settings.ini
" ]; then
gtk3theme=
$(grep "^[^#]*$name" /etc/gtk-3.0/settings.ini)
gtk3theme=
"
$(
grep
"^[^#]*
$name
"
/etc/gtk-3.0/settings.ini
)
"
fi
fi
gtk3theme=
${gtk3theme/${name}*=}
gtk3theme=
"
${
gtk3theme
/
${
name
}
*=
}
"
gtk3theme=
${gtk3theme//\"}
gtk3theme=
"
${
gtk3theme
//\
"}"
gtk3theme=
${gtk3theme/[[:space:]]/ }
gtk3theme=
"
${
gtk3theme
/[[
:space:]]/
}
"
fi
fi
# Uppercase the first letter of each gtk theme
# Uppercase the first letter of each gtk theme
if [
"
$version
"
-ge 4 ]; then
if [
"
$version
"
-ge 4 ]; then
gtk2theme=
${gtk2theme^}
gtk2theme=
"
${
gtk2theme
^
}
"
gtk3theme=
${gtk3theme^}
gtk3theme=
"
${
gtk3theme
^
}
"
fi
fi
# Toggle visibility of gtk themes.
# Toggle visibility of gtk themes.
...
@@ -1721,15 +1721,15 @@ getstyle () {
...
@@ -1721,15 +1721,15 @@ getstyle () {
# Final string
# Final string
theme=
"
${
gtk2theme
}${
gtk3theme
}
"
theme=
"
${
gtk2theme
}${
gtk3theme
}
"
theme=
${theme//\"}
theme=
"
${
theme
//\
"}"
theme=
${theme//\'
}
theme=
"
${
theme
//\
'}"
theme=
${
theme
// /
}
theme=
"${theme// / }"
# Make the output shorter by removing "[GTKX]" from the string
# Make the output shorter by removing "[GTKX]" from the string
if [ "$gtk_shorthand" == "on" ]; then
if [ "$gtk_shorthand" == "on" ]; then
theme=
${
theme
/
'[GTK2]'
}
theme=
"${theme/ '
[GTK2]
'}"
theme=
${
theme
/
'[GTK3]'
}
theme=
"${theme/ '
[GTK3]
'}"
theme=
${
theme
/
'[GTK2/3]'
}
theme=
"${theme/ '
[GTK2/3]
'}"
fi
fi
fi
fi
}
}
...
@@ -1768,11 +1768,11 @@ getterm () {
...
@@ -1768,11 +1768,11 @@ getterm () {
"Windows"
)
"Windows"
)
parent=
"
$(
ps
-p
${
1
:-
$PPID
}
|
awk
'{printf $2}'
)
"
parent=
"
$(
ps
-p
${
1
:-
$PPID
}
|
awk
'{printf $2}'
)
"
parent=
${
parent
/
'PPID'
}
parent=
"
${
parent
/
'PPID'
}
"
name=
"
$(
ps
-p
$parent
|
awk
'{printf $8}'
)
"
name=
"
$(
ps
-p
$parent
|
awk
'{printf $8}'
)
"
name=
${
name
/
'COMMAND'
}
name=
"
${
name
/
'COMMAND'
}
"
name=
${
name
/*\/
}
name=
"
${
name
/*\/
}
"
;;
;;
*)
*)
...
@@ -1783,7 +1783,7 @@ getterm () {
...
@@ -1783,7 +1783,7 @@ getterm () {
case
"
${
name
//
}
"
in
case
"
${
name
//
}
"
in
"
${
SHELL
/*\/
}
"
| *
"sh"
|
"tmux"
|
"screen"
) getterm
"
$parent
"
;;
"
${
SHELL
/*\/
}
"
| *
"sh"
|
"tmux"
|
"screen"
) getterm
"
$parent
"
;;
"
login
" | "
init
") term="
$(
tty
)
"; term=
${
term
/*\/
}
;;
"login"
|
"init"
) term=
"
$(
tty
)
"
; term=
"
${
term
/*\/
}
"
;;
"ruby"
|
"1"
|
"systemd"
|
"sshd"
|
"python"
*) unset term ;;
"ruby"
|
"1"
|
"systemd"
|
"sshd"
|
"python"
*) unset term ;;
"gnome-terminal-"
) term=
"gnome-terminal"
;;
"gnome-terminal-"
) term=
"gnome-terminal"
;;
*) term=
"
$name
"
;;
*) term=
"
$name
"
;;
...
@@ -1800,14 +1800,14 @@ gettermfont () {
...
@@ -1800,14 +1800,14 @@ gettermfont () {
case "
$term
" in
case "
$term
" in
"
urxvt
" | "
urxvtd
" | "
xterm
")
"
urxvt
" | "
urxvtd
" | "
xterm
")
termfont="
$(
grep
-i
"
${
term
/d
}
\*
font"
<<<
$(
xrdb
-query
))
"
termfont="
$(
grep
-i
"
${
term
/d
}
\*
font"
<<<
$(
xrdb
-query
))
"
termfont=
${
termfont
/*font
:
}
termfont=
"
${
termfont
/*font
:
}
"
# Xresources has two different font syntax, this checks which
# Xresources has two different font syntax, this checks which
# one is in use and formats it accordingly.
# one is in use and formats it accordingly.
case "
$termfont
" in
case "
$termfont
" in
"
xft
:
"*)
"
xft
:
"*)
termfont=
${
termfont
/xft
:
}
termfont=
"
${
termfont
/xft
:
}
"
termfont=
${
termfont
/
:
*
}
termfont=
"
${
termfont
/
:
*
}
"
;;
;;
"
-
"*) termfont="
$(
awk
-F
'\\-'
'{printf $3}'
<<<
"
$termfont
"
)
" ;;
"
-
"*) termfont="
$(
awk
-F
'\\-'
'{printf $3}'
<<<
"
$termfont
"
)
" ;;
...
@@ -1849,26 +1849,26 @@ getdisk () {
...
@@ -1849,26 +1849,26 @@ getdisk () {
esac
esac
# Get the disk info
# Get the disk info
disk=
$(
df
$df_flags
2>/dev/null |
awk
'END{print $2 ":" $3 ":" $5}'
)
disk=
"
$(
df
$df_flags
2>/dev/null |
awk
'END{print $2 ":" $3 ":" $5}'
)
"
# Format the output
# Format the output
disk_used=
${
disk
#*
:
}
disk_used=
"
${
disk
#*
:
}
"
disk_used=
${
disk_used
%%
:
*
}
disk_used=
"
${
disk_used
%%
:
*
}
"
disk_total=
${
disk
%%
:
*
}
disk_total=
"
${
disk
%%
:
*
}
"
disk_total_per=
${
disk
#*
:
*
:
}
disk_total_per=
"
${
disk
#*
:
*
:
}
"
# Put it all together
# Put it all together
disk="
${
disk_used
}
/
${
disk_total
}
(
${
disk_total_per
}
)
"
disk="
${
disk_used
}
/
${
disk_total
}
(
${
disk_total_per
}
)
"
# Add info bar
# Add info bar
disk_used=
${
disk_used
/G
}
disk_used=
"
${
disk_used
/G
}
"
disk_total=
${
disk_total
/G
}
disk_total=
"
${
disk_total
/G
}
"
[[ "
$disk_used
" == *"
T
" ]] &&
\
[[ "
$disk_used
" == *"
T
" ]] &&
\
disk_used=
$(
printf
"%s
\n
"
"
${
disk_used
/T
}
* 1000"
| bc
)
disk_used=
"
$(
printf
"%s
\n
"
"
${
disk_used
/T
}
* 1000"
| bc
)
"
[[ "
$disk_total
" == *"
T
" ]] &&
\
[[ "
$disk_total
" == *"
T
" ]] &&
\
disk_total=
$(
printf
"%s
\n
"
"
${
disk_total
/T
}
* 1000"
| bc
)
disk_total=
"
$(
printf
"%s
\n
"
"
${
disk_total
/T
}
* 1000"
| bc
)
"
case "
$disk_display
" in
case "
$disk_display
" in
"
bar
") disk="
$(
bar
"
${
disk_used
/
'.'
*
}
"
"
${
disk_total
/
'.'
*
}
"
)
" ;;
"
bar
") disk="
$(
bar
"
${
disk_used
/
'.'
*
}
"
"
${
disk_total
/
'.'
*
}
"
)
" ;;
...
@@ -1900,8 +1900,8 @@ getbattery () {
...
@@ -1900,8 +1900,8 @@ getbattery () {
# If shorthand is on, print each value on the same line
# If shorthand is on, print each value on the same line
if [ "
$battery_shorthand
" == "
on
" ] || [ "
$stdout_mode
" == "
on
" ]; then
if [ "
$battery_shorthand
" == "
on
" ] || [ "
$stdout_mode
" == "
on
" ]; then
battery=
${
batteries
[*]
}
battery=
"
${
batteries
[*]
}
"
battery=
${
battery
// /%,
}
battery=
"
${
battery
// /%,
}
"
battery="
${
battery
}
%
"
battery="
${
battery
}
%
"
else
else
...
@@ -1916,7 +1916,7 @@ getbattery () {
...
@@ -1916,7 +1916,7 @@ getbattery () {
"
barinfo
") prin "
${
title
}${
index
:-
0
}
" "
$(
bar
"
${
bat
/
'%'
}
"
100
)
${
bat
}
%
" ;;
"
barinfo
") prin "
${
title
}${
index
:-
0
}
" "
$(
bar
"
${
bat
/
'%'
}
"
100
)
${
bat
}
%
" ;;
*) prin "
${
title
}${
index
:-
0
}
" "
${
bat
}
%
" ;;
*) prin "
${
title
}${
index
:-
0
}
" "
${
bat
}
%
" ;;
esac
esac
index=
$((
index+
=
1
))
index=
"
$((
index+
=
1
))
"
done
done
return
return
fi
fi
...
@@ -1928,22 +1928,22 @@ getbattery () {
...
@@ -1928,22 +1928,22 @@ getbattery () {
"
BSD
")
"
BSD
")
case "
$distro
" in
case "
$distro
" in
"
FreeBSD
"* | "
DragonFly
"*)
"
FreeBSD
"* | "
DragonFly
"*)
battery=
$(
acpiconf
-i
0 |
awk
-F
':\t'
'/Remaining capacity/ {print $2}'
)
battery=
"
$(
acpiconf
-i
0 |
awk
-F
':\t'
'/Remaining capacity/ {print $2}'
)
"
battery_state=
$(
acpiconf
-i
0 |
awk
-F
':\t\t\t'
'/State/ {print $2}'
)
battery_state=
"
$(
acpiconf
-i
0 |
awk
-F
':\t\t\t'
'/State/ {print $2}'
)
"
;;
;;
"
NetBSD
"*)
"
NetBSD
"*)
battery=
$(
envstat |
awk
'\\(|\\)'
'/charge:/ {print $2}'
)
battery=
"
$(
envstat |
awk
'\\(|\\)'
'/charge:/ {print $2}'
)
"
battery="
${
battery
/\.*/%
}
"
battery="
${
battery
/\.*/%
}
"
;;
;;
esac
esac
;;
;;
"
OpenBSD
")
"
OpenBSD
")
battery0full=
$(
sysctl
-n
hw.sensors.acpibat0.watthour0
)
battery0full=
"
$(
sysctl
-n
hw.sensors.acpibat0.watthour0
)
"
battery0full=
${
battery0full
/ Wh*
}
battery0full=
"
${
battery0full
/ Wh*
}
"
battery0now=
$(
sysctl
-n
hw.sensors.acpibat0.watthour3
)
battery0now=
"
$(
sysctl
-n
hw.sensors.acpibat0.watthour3
)
"
battery0now="
${
battery0now
/ Wh*
}
"
battery0now="
${
battery0now
/ Wh*
}
"
[ ! -z "
$battery0full
" ] &&
\
[ ! -z "
$battery0full
" ] &&
\
...
@@ -1957,9 +1957,9 @@ getbattery () {
...
@@ -1957,9 +1957,9 @@ getbattery () {
"
Windows
")
"
Windows
")
battery="
$(
wmic Path Win32_Battery get EstimatedChargeRemaining /value
)
"
battery="
$(
wmic Path Win32_Battery get EstimatedChargeRemaining /value
)
"
battery=
${
battery
/EstimatedChargeRemaining
'='
}
battery=
"
${
battery
/EstimatedChargeRemaining
'='
}
"
battery=
${
battery
//[[
:space:]]/
}
battery=
"
${
battery
//[[
:space:]]/
}
"
battery=
${
battery
//
}
battery=
"
${
battery
//
}
"
[ ! -z "
$battery
" ] &&
\
[ ! -z "
$battery
" ] &&
\
battery+="
%
"
battery+="
%
"
;;
;;
...
@@ -2021,7 +2021,7 @@ getpublicip () {
...
@@ -2021,7 +2021,7 @@ getpublicip () {
getusers () {
getusers () {
users="
$(
who
|
awk
'!seen[$1]++ {printf $1 ", "}'
)
"
users="
$(
who
|
awk
'!seen[$1]++ {printf $1 ", "}'
)
"
users=
${
users
%\,*
}
users=
"
${
users
%\,*
}
"
}
}
# }}}
# }}}
...
@@ -2039,8 +2039,8 @@ getbirthday () {
...
@@ -2039,8 +2039,8 @@ getbirthday () {
birthday="
$(
ls
-lUT
/var/log/install.log |
awk
'{printf $6 " " $7 " " $9 " " $8}'
)
"
birthday="
$(
ls
-lUT
/var/log/install.log |
awk
'{printf $6 " " $7 " " $9 " " $8}'
)
"
# Split the string into Date + time
# Split the string into Date + time
time=
${
birthday
/*????
}
time=
"
${
birthday
/*????
}
"
birthday=
${
birthday
/
$time
}
birthday=
"
${
birthday
/
$time
}
"
case "
${
time
/
:
*
}
" in
case "
${
time
/
:
*
}
" in
0? | 10 | 11) time+="
AM
" ;;
0? | 10 | 11) time+="
AM
" ;;
...
@@ -2076,15 +2076,15 @@ getbirthday () {
...
@@ -2076,15 +2076,15 @@ getbirthday () {
esac
esac
# Strip seconds from time output
# Strip seconds from time output
birthday=
${
birthday
/
:??
/
}
birthday=
"
${
birthday
/
:??
/
}
"
# Pretty output
# Pretty output
[ "
$birthday_shorthand
" == "
off
" ] &&
\
[ "
$birthday_shorthand
" == "
off
" ] &&
\
birthday=
${
date_cmd
//+( )/
}
birthday=
"
${
date_cmd
//+( )/
}
"
# Toggle showing the time
# Toggle showing the time
[ "
$birthday_time
" == "
off
" ] &&
\
[ "
$birthday_time
" == "
off
" ] &&
\
birthday=
${
birthday
/??
:??
*
}
birthday=
"
${
birthday
/??
:??
*
}
"
}
}
# }}}
# }}}
...
@@ -2094,7 +2094,7 @@ getbirthday () {
...
@@ -2094,7 +2094,7 @@ getbirthday () {
getcols () {
getcols () {
if [ "
$color_blocks
" == "
on
" ]; then
if [ "
$color_blocks
" == "
on
" ]; then
# Convert the width to space chars.
# Convert the width to space chars.
block_width=
$(
printf
"%
$((
block_width-
=
1
))
s"
)
block_width=
"
$(
printf
"%
$((
block_width-
=
1
))
s"
)
"
# Generate the string.
# Generate the string.
while [
$start
-le
$end
]; do
while [
$start
-le
$end
]; do
...
@@ -2103,19 +2103,19 @@ getcols () {
...
@@ -2103,19 +2103,19 @@ getcols () {
7) blocks+="
\033[0m\033[3
${
start
}
m
\033[4
${
start
}
m
%
${
block_width
}
s
" ;;
7) blocks+="
\033[0m\033[3
${
start
}
m
\033[4
${
start
}
m
%
${
block_width
}
s
" ;;
*) blocks2+="
\033[38;5;
${
start
}
m
\033[48;5;
${
start
}
m
%
${
block_width
}
s
" ;;
*) blocks2+="
\033[38;5;
${
start
}
m
\033[48;5;
${
start
}
m
%
${
block_width
}
s
" ;;
esac
esac
start=
$((
start+
=
1
))
start=
"
$((
start+
=
1
))
"
done
done
# Convert height into spaces.
# Convert height into spaces.
spaces="
$(
printf
"%
${
block_height
}
s"
)
"
spaces="
$(
printf
"%
${
block_height
}
s"
)
"
# Convert the spaces into rows of blocks.
# Convert the spaces into rows of blocks.
[ ! -z "
$blocks
" ] && cols+=
${
spaces
// /
${
blocks
}
"
\0
33[0m"
nl
}
[ ! -z "
$blocks
" ] && cols+=
"
${
spaces
// /
${
blocks
}
"
\0
33[0m"
nl
}
"
[ ! -z "
$blocks2
" ] && cols+=
${
spaces
// /
${
blocks2
}
"
\0
33[0m"
nl
}
[ ! -z "
$blocks2
" ] && cols+=
"
${
spaces
// /
${
blocks2
}
"
\0
33[0m"
nl
}
"
# Add newlines to the string.
# Add newlines to the string.
cols=
${
cols
%%
'nl'
}
cols=
"
${
cols
%%
'nl'
}
"
cols=
${
cols
//nl/\\n
${
padding
}}
cols=
"
${
cols
//nl/\\n
${
padding
}}
"
fi
fi
}
}
...
@@ -2148,8 +2148,8 @@ getwallpaper () {
...
@@ -2148,8 +2148,8 @@ getwallpaper () {
esac
esac
# Strip quotes etc from the path.
# Strip quotes etc from the path.
img=
${
img
/
'file://'
}
img=
"
${
img
/
'file://'
}
"
img=
${
img
//\
'}
img=
"
${
img
//\
'}"
fi
fi
;;
;;
...
@@ -2192,9 +2192,9 @@ getascii () {
...
@@ -2192,9 +2192,9 @@ getascii () {
# Lowercase the distro name
# Lowercase the distro name
if [ "
$version
" -le 3 ]; then
if [ "
$version
" -le 3 ]; then
ascii=
$(
tr
'[:upper:]'
'[:lower:]'
<<<
"
$ascii_distro
"
)
ascii=
"
$(
tr
'[:upper:]'
'[:lower:]'
<<<
"
$ascii_distro
"
)
"
else
else
ascii=
${
ascii_distro
,,
}
ascii=
"
${
ascii_distro
,,
}
"
fi
fi
[ "
$ascii_logo_size
" == "
small
" ] &&
\
[ "
$ascii_logo_size
" == "
small
" ] &&
\
...
@@ -2235,15 +2235,15 @@ getascii () {
...
@@ -2235,15 +2235,15 @@ getascii () {
export LC_ALL="
$SYS_LOCALE
"
export LC_ALL="
$SYS_LOCALE
"
# Turn the file into a variable and strip escape codes.
# Turn the file into a variable and strip escape codes.
ascii_strip=
$(
<
"
$ascii
"
)
ascii_strip=
"
$(
<
"
$ascii
"
)
"
ascii_strip=
${
ascii_strip
//\
$\
{??\
}
}
ascii_strip=
"
${
ascii_strip
//\
$\
{??\
}}
"
ascii_strip=
${
ascii_strip
//
'\\'
/
}
ascii_strip=
"
${
ascii_strip
//
'\\'
/
}
"
ascii_strip=
${
ascii_strip
//
'\'
}
ascii_strip=
"
${
ascii_strip
//
'\'
}
"
# Get ascii file size in rows/cols
# Get ascii file size in rows/cols
ascii_size="
$(
awk
'END {printf NR " "}length>max{max=length}END{printf max}'
<<<
"
$ascii_strip
"
)
"
ascii_size="
$(
awk
'END {printf NR " "}length>max{max=length}END{printf max}'
<<<
"
$ascii_strip
"
)
"
lines=
${
ascii_size
/ *
}
lines=
"
${
ascii_size
/ *
}
"
ascii_length=
${
ascii_size
/
$lines
}
ascii_length=
"
${
ascii_size
/
$lines
}
"
padding="
\0
33[
$((
ascii_length
+
gap
))
C
"
padding="
\0
33[
$((
ascii_length
+
gap
))
C
"
printf "
%b%s
" "
$print
"
printf "
%b%s
" "
$print
"
...
@@ -2293,70 +2293,70 @@ getimage () {
...
@@ -2293,70 +2293,70 @@ getimage () {
# Split the string
# Split the string
if [ "
$image_backend
" == "
tycat
" ]; then
if [ "
$image_backend
" == "
tycat
" ]; then
term_size=(
${
term_size
//;/
}
)
term_size=(
${
term_size
//;/
}
)
term_width=
$((
term_size[2]
*
term_size[0]
))
term_width=
"
$((
term_size[2]
*
term_size[0]
))
"
term_height=
$((
term_size[3]
*
term_size[1]
))
term_height=
"
$((
term_size[3]
*
term_size[1]
))
"
else
else
term_size=
${
term_size
//
'['
}
term_size=
"
${
term_size
//
'['
}
"
term_size=
${
term_size
/
';'
}
term_size=
"
${
term_size
/
';'
}
"
term_size=
${
term_size
/
$'
\E
4'
}
term_size=
"
${
term_size
/
$'
\E
4'
}
"
term_size=
${
term_size
/t*
}
term_size=
"
${
term_size
/t*
}
"
term_height=
${
term_size
/
';'
*
}
term_height=
"
${
term_size
/
';'
*
}
"
term_width=
${
term_size
/*
';'
}
term_width=
"
${
term_size
/*
';'
}
"
fi
fi
# If
$img
isn't a file or the terminal doesn't support xterm escape sequences,
# If
$img
isn't a file or the terminal doesn't support xterm escape sequences,
# fallback to ascii mode.
# fallback to ascii mode.
if [ ! -f
"
$img
"
] || ([
${#
term_size
}
-le 5 ] && [
"
$image_backend
"
!=
"tycat"
]); then
if [ ! -f "
$img
" ] || ([
"
${#
term_size
}
"
-le 5 ] && [ "
$image_backend
" != "
tycat
" ]); then
image="
ascii
"
image="
ascii
"
getascii
getascii
# Error messages
# Error messages
[ ! -f "
$img
" ] && err "
\$
img, isn
't a file, falling back to ascii mode."
[ ! -f "
$img
" ] && err "
\$
img, isn
't a file, falling back to ascii mode."
[
${#
term_size
}
-le 5 ] && err
"Your terminal doesn't support
\\\0
33[14t, falling back to ascii mode."
[
"${#term_size}"
-le 5 ] && err "Your terminal doesn'
t support
\\\0
33[14t, falling back to ascii mode.
"
return
return
fi
fi
# Get terminal lines and columns
# Get terminal lines and columns
lines=
$(
tput lines
)
lines=
"
$(
tput lines
)
"
columns=
$(
tput cols
)
columns=
"
$(
tput cols
)
"
# Calculate font size
# Calculate font size
font_width=
$((
term_width
/
columns
))
font_width=
"
$((
term_width
/
columns
))
"
# Image size is half of the terminal
# Image size is half of the terminal
case "
$image_size
" in
case "
$image_size
" in
"
auto
")
"
auto
")
image_size=
$((
columns
*
font_width
/
2
))
image_size=
"
$((
columns
*
font_width
/
2
))
"
term_height=
$((
term_height
-
term_height
/
4
))
term_height=
"
$((
term_height
-
term_height
/
4
))
"
[ "
$term_height
" -lt "
$image_size
" ] &&
\
[ "
$term_height
" -lt "
$image_size
" ] &&
\
image_size="
$term_height
"
image_size="
$term_height
"
;;
;;
*"
%
")
*"
%
")
percent=
${
image_size
/\%
}
percent=
"
${
image_size
/\%
}
"
image_size=
$((
percent
*
term_width
/
100
))
image_size=
"
$((
percent
*
term_width
/
100
))
"
[ "
$((
percent
*
term_height
/
50
))
" -lt "
$image_size
" ] &&
\
[ "
$((
percent
*
term_height
/
50
))
" -lt "
$image_size
" ] &&
\
image_size=
$((
percent
*
term_height
/
100
))
image_size=
"
$((
percent
*
term_height
/
100
))
"
;;
;;
"
none
")
"
none
")
# Get image size so that we can do a better crop
# Get image size so that we can do a better crop
size=
$(
identify
-format
"%w %h"
"
$img
"
)
size=
"
$(
identify
-format
"%w %h"
"
$img
"
)
"
width=
${
size
%% *
}
width=
"
${
size
%% *
}
"
height=
${
size
##*
}
height=
"
${
size
##*
}
"
crop_mode="
none
"
crop_mode="
none
"
;;
;;
*) image_size=
${
image_size
/px
}
;;
*) image_size=
"
${
image_size
/px
}
"
;;
esac
esac
# Fallback if width / height are empty.
# Fallback if width / height are empty.
width=
${
width
:-
$image_size
}
width=
"
${
width
:-
$image_size
}
"
height=
${
height
:-
$image_size
}
height=
"
${
height
:-
$image_size
}
"
# Where to draw the image
# Where to draw the image
case "
$image_position
" in
case "
$image_position
" in
...
@@ -2367,7 +2367,7 @@ getimage () {
...
@@ -2367,7 +2367,7 @@ getimage () {
"
right
")
"
right
")
padding="
\0
33[0C
"
padding="
\0
33[0C
"
xoffset=
$((
columns
*
font_width
/
2
-
gap
))
xoffset=
"
$((
columns
*
font_width
/
2
-
gap
))
"
;;
;;
esac
esac
...
@@ -2385,21 +2385,21 @@ getimage () {
...
@@ -2385,21 +2385,21 @@ getimage () {
if [ ! -f "
$thumbnail_dir
/
$imgname
" ]; then
if [ ! -f "
$thumbnail_dir
/
$imgname
" ]; then
# Get image size so that we can do a better crop
# Get image size so that we can do a better crop
if [ -z "
$size
" ]; then
if [ -z "
$size
" ]; then
size=
$(
identify
-format
"%w %h"
"
$img
"
)
size=
"
$(
identify
-format
"%w %h"
"
$img
"
)
"
og_width=
${
size
%% *
}
og_width=
"
${
size
%% *
}
"
og_height=
${
size
##*
}
og_height=
"
${
size
##*
}
"
# This checks to see if height is geater than width
# This checks to see if height is geater than width
# so we can do a better crop of portrait images.
# so we can do a better crop of portrait images.
size=
$og_height
size=
"
$og_height
"
[
"
$og_height
"
-gt
"
$og_width
"
] && size=
$og_width
[ "
$og_height
" -gt "
$og_width
" ] && size=
"
$og_width
"
fi
fi
case "
$crop_mode
" in
case "
$crop_mode
" in
fit)
fit)
c=
$(
convert
"
$img
"
\
c=
"
$(
convert
"
$img
"
\
-colorspace
srgb
\
-colorspace
srgb
\
-format
"%[pixel:p{0,0}]"
info:
)
-format
"%[pixel:p{0,0}]"
info:
)
"
convert
\
convert
\
"
$img
"
\
"
$img
"
\
...
@@ -2500,7 +2500,7 @@ info () {
...
@@ -2500,7 +2500,7 @@ info () {
title
)
title
)
string
=
"
${
title_color
}${
bold
}${
output
}
"
string
=
"
${
title_color
}${
bold
}${
output
}
"
string
=
"
${
string
/@/
${
at_color
}
@
${
title_color
}${
bold
}}
"
string
=
"
${
string
/@/
${
at_color
}
@
${
title_color
}${
bold
}}
"
length
=
${#
output
}
length
=
"
${#
output
}
"
;;
;;
underline
)
underline
)
...
@@ -2510,12 +2510,12 @@ info () {
...
@@ -2510,12 +2510,12 @@ info () {
*
)
*
)
string
=
"
${
subtitle_color
}${
bold
}${
subtitle
}
\0
33[0m"
string
=
"
${
subtitle_color
}${
bold
}${
subtitle
}
\0
33[0m"
string+
=
"
${
colon_color
}
:
${
info_color
}${
output
}
"
string+
=
"
${
colon_color
}
:
${
info_color
}${
output
}
"
length
=
$((${#
subtitle
}
+
${#
output
}
+
2
))
length
=
"
$((${#
subtitle
}
+
${#
output
}
+
2
))
"
;;
;;
esac
esac
# If there's no subtitle don't print one
# If there's no subtitle don't print one
[
-
z
"
$2
"
]
&&
string
=
${
string
/*
:
}
[
-z
"
$2
"
]
&&
string
=
"
${
string
/*
:
}
"
# Print the string
# Print the string
printf
"%b%s
\n
"
"
${
padding
}${
string
}
\0
33[0m"
printf
"%b%s
\n
"
"
${
padding
}${
string
}
\0
33[0m"
...
@@ -2528,12 +2528,12 @@ info () {
...
@@ -2528,12 +2528,12 @@ info () {
prin
()
{
prin
()
{
if
[
-z
"
$2
"
]
;
then
if
[
-z
"
$2
"
]
;
then
string
=
"
${
info_color
}${
1
}
"
string
=
"
${
info_color
}${
1
}
"
length
=
${#
1
}
length
=
"
${#
1
}
"
else
else
string
=
"
${
subtitle_color
}${
bold
}${
1
}
\0
33[0m"
string
=
"
${
subtitle_color
}${
bold
}${
1
}
\0
33[0m"
string+
=
"
${
colon_color
}
:
${
info_color
}${
2
}
"
string+
=
"
${
colon_color
}
:
${
info_color
}${
2
}
"
length
=
$((${#
subtitle
}
+
${#
2
}
+
1
))
length
=
"
$((${#
subtitle
}
+
${#
2
}
+
1
))
"
fi
fi
# Print the info
# Print the info
...
@@ -2547,7 +2547,7 @@ prin () {
...
@@ -2547,7 +2547,7 @@ prin () {
stdout
()
{
stdout
()
{
# Read args early for the separator
# Read args early for the separator
stdout_separator_flag
=
"
$(
awk
-F
'--stdout_separator '
'{printf $2}'
<<<
"
${
args
[@]
}
"
)
"
stdout_separator_flag
=
"
$(
awk
-F
'--stdout_separator '
'{printf $2}'
<<<
"
${
args
[@]
}
"
)
"
stdout_separator_flag
=
${
stdout_separator_flag
/
'--'
*
}
stdout_separator_flag
=
"
${
stdout_separator_flag
/
'--'
*
}
"
[
!
-z
"
$stdout_separator_flag
"
]
&&
\
[
!
-z
"
$stdout_separator_flag
"
]
&&
\
stdout_separator
=
"
$stdout_separator_flag
"
stdout_separator
=
"
$stdout_separator_flag
"
...
@@ -2574,8 +2574,8 @@ stdout () {
...
@@ -2574,8 +2574,8 @@ stdout () {
getunderline
()
{
getunderline
()
{
case
"
$underline_enabled
"
in
case
"
$underline_enabled
"
in
"on"
)
"on"
)
underline
=
$(
printf
%
"
$length
"
s
)
underline
=
"
$(
printf
%
"
$length
"
s
)
"
underline
=
${
underline
// /
$underline_char
}
underline
=
"
${
underline
// /
$underline_char
}
"
;;
;;
"off"
)
underline
=
""
;;
"off"
)
underline
=
""
;;
esac
esac
...
@@ -2815,7 +2815,7 @@ getlinebreak () {
...
@@ -2815,7 +2815,7 @@ getlinebreak () {
getscriptdir
()
{
getscriptdir
()
{
# Use $0 to get the script's physical path.
# Use $0 to get the script's physical path.
cd
"
${
0
%/*
}
"
||
exit
cd
"
${
0
%/*
}
"
||
exit
script_dir
=
${
0
##*/
}
script_dir
=
"
${
0
##*/
}
"
# Iterate down a (possible) chain of symlinks.
# Iterate down a (possible) chain of symlinks.
while
[
-L
"
$script_dir
"
]
;
do
while
[
-L
"
$script_dir
"
]
;
do
...
@@ -2877,11 +2877,11 @@ esac
...
@@ -2877,11 +2877,11 @@ esac
bar
()
{
bar
()
{
# Get the values
# Get the values
elapsed
=
$((
$1
*
progress_length
/
$2
))
elapsed
=
"
$((
$1
*
progress_length
/
$2
))
"
# Create the bar with spaces
# Create the bar with spaces
prog
=
$(
printf
%
"
$elapsed
"
s
)
prog
=
"
$(
printf
%
"
$elapsed
"
s
)
"
total
=
$(
printf
%
"
$((
progress_length
-
elapsed
))
"
s
)
total
=
"
$(
printf
%
"
$((
progress_length
-
elapsed
))
"
s
)
"
# Set the colors and swap the spaces for $progress_char
# Set the colors and swap the spaces for $progress_char
bar+
=
"
${
progress_color_elapsed
}${
prog
// /
$progress_char_elapsed
}
"
bar+
=
"
${
progress_color_elapsed
}${
prog
// /
$progress_char_elapsed
}
"
...
@@ -2914,13 +2914,13 @@ kdeconfigdir () {
...
@@ -2914,13 +2914,13 @@ kdeconfigdir () {
kde_config_dir
=
"
$KDE_CONFIG_DIR
"
kde_config_dir
=
"
$KDE_CONFIG_DIR
"
elif
type
-p
kde5-config
>
/dev/null 2>&1
;
then
elif
type
-p
kde5-config
>
/dev/null 2>&1
;
then
kde_config_dir
=
$(
kde5-config
--localprefix
)
kde_config_dir
=
"
$(
kde5-config
--localprefix
)
"
elif
type
-p
kde4-config
>
/dev/null 2>&1
;
then
elif
type
-p
kde4-config
>
/dev/null 2>&1
;
then
kde_config_dir
=
$(
kde4-config
--localprefix
)
kde_config_dir
=
"
$(
kde4-config
--localprefix
)
"
elif
type
-p
kde-config
>
/dev/null 2>&1
;
then
elif
type
-p
kde-config
>
/dev/null 2>&1
;
then
kde_config_dir
=
$(
kde-config
--localprefix
)
kde_config_dir
=
"
$(
kde-config
--localprefix
)
"
fi
fi
}
}
...
@@ -3135,7 +3135,7 @@ while [ "$1" ]; do
...
@@ -3135,7 +3135,7 @@ while [ "$1" ]; do
# Color Blocks
# Color Blocks
--color_blocks
)
color_blocks
=
"
$2
"
;;
--color_blocks
)
color_blocks
=
"
$2
"
;;
--block_range
)
start
=
$2
;
end
=
$3
;;
--block_range
)
start
=
"
$2
"
;
end
=
"
$3
"
;;
--block_width
)
block_width
=
"
$2
"
;;
--block_width
)
block_width
=
"
$2
"
;;
--block_height
)
block_height
=
"
$2
"
;;
--block_height
)
block_height
=
"
$2
"
;;
...
...
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