Moved song to optional info, added getresolution to get screen res using xorg-xdpyinfo (disabled by default) and added uptime shorthand option to shorten the output of uptime
This commit is contained in:
parent
0e3fed419e
commit
cfa089e801
|
@ -59,6 +59,8 @@ Info:
|
|||
--distro string/cmd Manually set the distro
|
||||
--kernel string/cmd Manually set the kernel
|
||||
--uptime string/cmd Manually set the uptime
|
||||
--uptime_shorthand on/off --v
|
||||
Shorten the output of uptime
|
||||
--packages string/cmd Manually set the package count
|
||||
--shell string/cmd Manually set the shell
|
||||
--winman string/cmd Manually set the window manager
|
||||
|
|
46
fetch.sh
46
fetch.sh
|
@ -7,6 +7,7 @@
|
|||
# Wallpaper Display: feh
|
||||
# Current Song: mpc
|
||||
# Text formatting, dynamic image size and padding: tput
|
||||
# Resolution detection: xorg-xdpyinfo
|
||||
#
|
||||
# Created by Dylan Araps
|
||||
# https://github.com/dylanaraps/dotfiles
|
||||
|
@ -22,11 +23,17 @@ export LC_ALL=C
|
|||
|
||||
# Info
|
||||
# What to display and in what order.
|
||||
#
|
||||
# Format is: "Subtitle: function name"
|
||||
# Additional lines you can use include:
|
||||
# "underline" "linebreak" "echo: msg here" "title: title here"
|
||||
# You can also include your own lines by using:
|
||||
#
|
||||
# You can also include your own custom lines by using:
|
||||
# "echo: subtitlehere: $(custom cmd here)"
|
||||
# "echo: Custom string to print"
|
||||
#
|
||||
# Optional info lines that are disabled by default are:
|
||||
# "getresolution" "getsong"
|
||||
info=(
|
||||
"gettitle"
|
||||
"underline"
|
||||
|
@ -38,10 +45,8 @@ info=(
|
|||
"Window Manager: getwindowmanager"
|
||||
"CPU: getcpu"
|
||||
"Memory: getmemory"
|
||||
"Song: getsong"
|
||||
"linebreak"
|
||||
"getcols"
|
||||
"linebreak"
|
||||
)
|
||||
|
||||
# CPU
|
||||
|
@ -51,6 +56,12 @@ info=(
|
|||
speed_type="max"
|
||||
|
||||
|
||||
# Uptime
|
||||
|
||||
# Shorten the output of the uptime function
|
||||
uptime_shorthand="off"
|
||||
|
||||
|
||||
# Color Blocks
|
||||
|
||||
# Color block range
|
||||
|
@ -248,13 +259,19 @@ getuptime () {
|
|||
"OpenBSD")
|
||||
uptime=$(uptime | awk -F',' '{ print $1 }')
|
||||
uptime=${uptime# }
|
||||
uptime="${uptime# * up }"
|
||||
;;
|
||||
|
||||
*)
|
||||
uptime="Unknown"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
if [ "$uptime_shorthand" == "on" ]; then
|
||||
uptime=${uptime/up/}
|
||||
uptime=${uptime/minutes/mins}
|
||||
uptime=${uptime# }
|
||||
fi
|
||||
}
|
||||
|
||||
# Get package count
|
||||
|
@ -417,6 +434,24 @@ getsong () {
|
|||
song=$(mpc current 2>/dev/null || printf "%s" "Unknown")
|
||||
}
|
||||
|
||||
# Get Resolution
|
||||
getresolution () {
|
||||
case "$os" in
|
||||
"Linux"|"OpenBSD")
|
||||
resolution=$(xdpyinfo | awk '/dimensions:/ {printf $2}')
|
||||
;;
|
||||
|
||||
"Mac OS X")
|
||||
resolution=$(system_profiler SPDisplaysDataType | awk '/Resolution:/ {print $2"x"$4" "}')
|
||||
;;
|
||||
|
||||
*)
|
||||
resolution="Unknown"
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
getcols () {
|
||||
if [ "$color_blocks" == "on" ]; then
|
||||
printf "%s" "${padding}"
|
||||
|
@ -581,6 +616,8 @@ usage () {
|
|||
printf "%s\n" " --distro string/cmd Manually set the distro"
|
||||
printf "%s\n" " --kernel string/cmd Manually set the kernel"
|
||||
printf "%s\n" " --uptime string/cmd Manually set the uptime"
|
||||
printf "%s\n" " --uptime_shorthand on/off --v"
|
||||
printf "%s\n" " Shorten the output of uptime"
|
||||
printf "%s\n" " --packages string/cmd Manually set the package count"
|
||||
printf "%s\n" " --shell string/cmd Manually set the shell"
|
||||
printf "%s\n" " --winman string/cmd Manually set the window manager"
|
||||
|
@ -657,6 +694,7 @@ while [ ! -z "$1" ]; do
|
|||
--os) os="$2" ;;
|
||||
--kernel) kernel="$2" ;;
|
||||
--uptime) uptime="$2" ;;
|
||||
--uptime_shorthand) uptime_shorthand="$2" ;;
|
||||
--packages) packages="$2" ;;
|
||||
--shell) shell="$2" ;;
|
||||
--winman) windowmanager="$2" ;;
|
||||
|
|
Reference in New Issue