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