NetBSD support and stuff
This commit is contained in:
parent
1cc0c3418e
commit
5abeb68097
@ -15,6 +15,8 @@ CPU_TEMP_SCALE=1000
|
|||||||
# format for the date (by default in this script, ISO 8601)
|
# format for the date (by default in this script, ISO 8601)
|
||||||
alias date="date '+%Y-%m-%dT%T'"
|
alias date="date '+%Y-%m-%dT%T'"
|
||||||
|
|
||||||
|
DELIMITER=" || "
|
||||||
|
|
||||||
# how fast to refresh the display (in seconds, will be substituted with 1 if
|
# how fast to refresh the display (in seconds, will be substituted with 1 if
|
||||||
# not an integer)
|
# not an integer)
|
||||||
INTERVAL=1
|
INTERVAL=1
|
||||||
@ -29,15 +31,18 @@ INTERVAL=1
|
|||||||
PUBLIC_IP_FETCH_URL="http://ifconfig.io/"
|
PUBLIC_IP_FETCH_URL="http://ifconfig.io/"
|
||||||
|
|
||||||
get_battery_status() {
|
get_battery_status() {
|
||||||
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
# this is a dirty hack.
|
# this is a dirty hack.
|
||||||
# acpi | awk '{print $4}' will print the battery percentage,
|
# acpi | awk '{print $4}' will print the battery percentage,
|
||||||
# and s/,$// strips the trailing comma.
|
# and s/,$// strips the trailing comma.
|
||||||
# acpi -a will just print the power adapter status.
|
# acpi -a will just print the power adapter status.
|
||||||
printf "%b" "$(acpi | awk '{print $4}' | sed 's/,$//') ($(acpi -a))"
|
printf "%b" "$(acpi | awk '{print $4}' | sed 's/,$//') ($(acpi -a))"
|
||||||
return
|
return
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_cpu_temp() {
|
get_cpu_temp() {
|
||||||
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
RETVAL=""
|
RETVAL=""
|
||||||
# iterate over files, adjust, print out "%dC "
|
# iterate over files, adjust, print out "%dC "
|
||||||
for file in $CPU_TEMP_FILES;
|
for file in $CPU_TEMP_FILES;
|
||||||
@ -49,13 +54,28 @@ get_cpu_temp() {
|
|||||||
printf "%b" "$RETVAL" \
|
printf "%b" "$RETVAL" \
|
||||||
| python -c "from sys import stdin; print(stdin.read().rstrip() + '\n')"
|
| python -c "from sys import stdin; print(stdin.read().rstrip() + '\n')"
|
||||||
return
|
return
|
||||||
|
elif [ "$(uname)" = "NetBSD" ]; then
|
||||||
|
printf "%bC" "$(envstat -s coretemp0:'cpu0 temperature' \
|
||||||
|
| sed 1,2d \
|
||||||
|
| cut -d ':' -f 2 \
|
||||||
|
| awk '{print $1}' \
|
||||||
|
| cut -d '.' -f 1)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_current_desktop() {
|
||||||
|
case "$WM" in
|
||||||
|
(bspwm) bspc query -D -d focused --names ;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
get_memory_usage() {
|
get_memory_usage() {
|
||||||
|
if [ "$(uname)" = "Linux" ]; then
|
||||||
printf "%b" \
|
printf "%b" \
|
||||||
"$(free | head -n 2 | tail -n 1 \
|
"$(free | head -n 2 | tail -n 1 \
|
||||||
| awk '{print $3 " used / " $2 " total"}')"
|
| awk '{print $3 " used / " $2 " total"}')"
|
||||||
return
|
return
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_public_ip() {
|
get_public_ip() {
|
||||||
@ -68,13 +88,17 @@ get_public_ip() {
|
|||||||
PUBLIC_IP="$(get_public_ip)"
|
PUBLIC_IP="$(get_public_ip)"
|
||||||
|
|
||||||
printbar() {
|
printbar() {
|
||||||
printf "%b || %b || %b || %b || %b %b\n" \
|
printf "[%b] " "$(get_current_desktop)"
|
||||||
"$(date)" \
|
printf "%b" "$(date)"
|
||||||
"BAT: $(get_battery_status)" \
|
#printf "%b" "$DELIMITER"
|
||||||
"CPU: $(get_cpu_temp)" \
|
#printf "%b" "BAT: $(get_battery_status)"
|
||||||
"PuIP: $PUBLIC_IP" \
|
printf "%b" "$DELIMITER"
|
||||||
"MEM: $(get_memory_usage)" \
|
printf "%b" "CPU: $(get_cpu_temp)"
|
||||||
""
|
printf "%b" "$DELIMITER"
|
||||||
|
printf "%b" "PuIP: $PUBLIC_IP"
|
||||||
|
#printf "%b" "$DELIMITER"
|
||||||
|
#printf "%b" "MEM: $(get_memory_usage)"
|
||||||
|
printf "\n"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user