Update for FreeBSD on AMD Framework laptop.
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Read volume status in FreeBSD
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
|
||||
|
||||
while true; do
|
||||
current_vol_mixer=$(mixer -S vol)
|
||||
vol_left=$(cut -d ':' -f 2 <<<"$current_vol_mixer")
|
||||
vol_right=$(cut -d ':' -f 3 <<<"$current_vol_mixer")
|
||||
avg_vol=$(((vol_left + vol_right) / 2))
|
||||
tooltip="<tt>$(mixer)</tt>"
|
||||
class=""
|
||||
icon=""
|
||||
|
||||
if [ $avg_vol -eq 0 ]; then
|
||||
icon="🔇"
|
||||
elif [ $avg_vol -le 50 ]; then
|
||||
icon="🔉"
|
||||
else
|
||||
icon="🔊"
|
||||
fi
|
||||
|
||||
jq --unbuffered --compact-output <<EOF
|
||||
{
|
||||
"text":"${avg_vol}% ${icon}",
|
||||
"tooltip":"${tooltip//$'\n'/\\n}",
|
||||
"percentage":${avg_vol},
|
||||
"class":"${class}"
|
||||
}
|
||||
EOF
|
||||
sleep $SLEEP_INTERVAL
|
||||
done
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env zsh
|
||||
#
|
||||
# Read volume status in FreeBSD
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
|
||||
|
||||
while true; do
|
||||
(
|
||||
# current_vol_mixer=$(mixer -S vol)
|
||||
# vol_left=$(cut -d ':' -f 2 <<<"$current_vol_mixer")
|
||||
# vol_right=$(cut -d ':' -f 3 <<<"$current_vol_mixer")
|
||||
current_vol_mixer=$(mixer -o)
|
||||
vol_left=$(grep -E 'vol.volume=' <<<"$current_vol_mixer" | cut -d = -f 2 | cut -d ':' -f 1)
|
||||
vol_right=$(grep -E 'vol.volume=' <<<"$current_vol_mixer" | cut -d = -f 2 | cut -d ':' -f 2)
|
||||
avg_vol=$((100 * (vol_left + vol_right) / 2))
|
||||
avg_vol=$(echo "$avg_vol" | cut -d '.' -f 1)
|
||||
tooltip="<tt>$(mixer)</tt>"
|
||||
class=""
|
||||
icon=""
|
||||
|
||||
if [ $avg_vol -eq 0 ]; then
|
||||
icon="🔇"
|
||||
elif [ $avg_vol -le 50 ]; then
|
||||
icon="🔉"
|
||||
else
|
||||
icon="🔊"
|
||||
fi
|
||||
|
||||
jq --unbuffered --compact-output <<EOF
|
||||
{
|
||||
"text":"${avg_vol}% ${icon}",
|
||||
"tooltip":"${tooltip//$'\n'/\\n}",
|
||||
"percentage":${avg_vol},
|
||||
"class":"${class}"
|
||||
}
|
||||
EOF
|
||||
sleep $SLEEP_INTERVAL
|
||||
)
|
||||
done
|
||||
@@ -5,13 +5,11 @@ set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# TODO: Maybe I should be reading hw.acpi.thermal.tz0.temperature
|
||||
# TODO: I could get the number of cores with kern.smp.cpus
|
||||
|
||||
SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
|
||||
|
||||
while true; do
|
||||
current_cpu_temps=$(sysctl 'dev.cpu' | grep -E 'dev\.cpu\.[0-9]+\.temperature' | sort)
|
||||
current_cpu_temps=$(sysctl 'hw.acpi.thermal' | grep -E 'hw\.acpi\.thermal\.tz[0-9]+\.temperature' | sort)
|
||||
#current_cpu_temps=$(sysctl 'dev.cpu' | grep -E 'dev\.cpu\.[0-9]+\.temperature' | sort)
|
||||
sum_temperature=0
|
||||
num_temperature=0
|
||||
max_temperature=0
|
||||
|
||||
Reference in New Issue
Block a user