update;repurpose displayctl
This commit is contained in:
@ -1,8 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
DISPLAY_STATUS=$(xrandr | grep DP-2)
|
|
||||||
|
|
||||||
if [ "$DISPLAY_STATUS" = *"1440x3440"* ]; then
|
# unused for now, repurposing for ddcutil control
|
||||||
xrandr --output DP-2 --off
|
#DISPLAY_STATUS=$(xrandr | grep DP-2)
|
||||||
else
|
#
|
||||||
init_displays
|
#if [ "$DISPLAY_STATUS" = *"1440x3440"* ]; then
|
||||||
fi
|
# xrandr --output DP-2 --off
|
||||||
|
#else
|
||||||
|
# init_displays
|
||||||
|
#fi
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"brightness")
|
||||||
|
ddcutil setvcp 10 $2;;
|
||||||
|
"contrast")
|
||||||
|
ddcutil setvcp 12 $2;;
|
||||||
|
esac
|
||||||
|
|||||||
38
bin/st-power
38
bin/st-power
@ -2,13 +2,24 @@
|
|||||||
|
|
||||||
# for UPS monitoring with NUT
|
# for UPS monitoring with NUT
|
||||||
#
|
#
|
||||||
#POWER="$(upsc titanium-power@localhost | grep ups.realpower: | awk '{print $2}')W"
|
DATA_CMD="upsc ups@localhost"
|
||||||
#CHARGE="$(upsc titanium-power@localhost | grep battery.charge: | awk '{print $2}')%"
|
|
||||||
#if [ "$CHARGE" = "100%" ]; then
|
# on debian and freebsd, ups.realpower is not available.
|
||||||
# echo $POWER
|
# calculate load in watts with load percent and max output instead.
|
||||||
#else
|
MAX_OUTPUT=$($DATA_CMD | grep ups.realpower.nominal: | awk '{print $2}')
|
||||||
# echo "$CHARGE $POWER"
|
LOAD_VALUE=$($DATA_CMD | grep ups.load: | awk '{print $2}')
|
||||||
#fi
|
LOAD_PERCENT=$(echo "scale=2; $LOAD_VALUE/100" | bc)
|
||||||
|
POWER=$(echo "scale=0; $LOAD_PERCENT*$MAX_OUTPUT" | bc)
|
||||||
|
|
||||||
|
# "round" to integer. just removes decimal and whatevers after.
|
||||||
|
POWER="${POWER%.*} W"
|
||||||
|
CHARGE="$($DATA_CMD | grep battery.charge: | awk '{print $2}')%"
|
||||||
|
|
||||||
|
if [ "$CHARGE" = "100%" ]; then
|
||||||
|
echo $POWER
|
||||||
|
else
|
||||||
|
echo "$CHARGE $POWER"
|
||||||
|
fi
|
||||||
|
|
||||||
# for battery monitoring everywhere else
|
# for battery monitoring everywhere else
|
||||||
#
|
#
|
||||||
@ -17,14 +28,9 @@
|
|||||||
#CURRENT=$(cat /sys/class/power_supply/BAT*/current_now)
|
#CURRENT=$(cat /sys/class/power_supply/BAT*/current_now)
|
||||||
#POWER=$(echo "scale=2; $VOLTAGE*$CURRENT/1000000000000" | bc)
|
#POWER=$(echo "scale=2; $VOLTAGE*$CURRENT/1000000000000" | bc)
|
||||||
|
|
||||||
# freebsd
|
|
||||||
#CHARGE=$(acpiconf -i 0 | grep "Remaining capacity" | awk '{print $3}')
|
|
||||||
#POWER_RAW=$(acpiconf -i 0 | grep "Present rate:" | awk '{print $3}')
|
|
||||||
#POWER="$(echo "scale=1; $POWER_RAW/1000" | bc)W"
|
|
||||||
|
|
||||||
# if it is present, just divide it to watts (from micro watts on thinkpads, perhaps something else on other platforms)
|
# if it is present, just divide it to watts (from micro watts on thinkpads, perhaps something else on other platforms)
|
||||||
POWER=$(cat /sys/class/power_supply/BAT*/power_now)
|
#POWER=$(cat /sys/class/power_supply/BAT*/power_now)
|
||||||
POWER="$(echo "scale=2; $POWER/1000000" | bc)W"
|
#POWER="$(echo "scale=2; $POWER/1000000" | bc)W"
|
||||||
CHARGE="$(cat /sys/class/power_supply/BAT*/capacity)%"
|
#CHARGE="$(cat /sys/class/power_supply/BAT*/capacity)%"
|
||||||
|
|
||||||
echo "$CHARGE $POWER"
|
#echo "$CHARGE $POWER"
|
||||||
|
|||||||
Reference in New Issue
Block a user