2024-12-26 15:19:33 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
tv_on() {
|
|
|
|
|
cec-ctl --to 0 --image-view-on
|
2026-02-17 10:03:23 -08:00
|
|
|
#xrandr --output HDMI-A-0 --mode 1920x1080
|
|
|
|
|
xrandr --output HDMI-A-0 --auto; sleep 3; xrandr --output HDMI-A-0 --mode 1920x1080
|
2024-12-26 15:19:33 -08:00
|
|
|
echo "on">~/scripts/PJ/tv_state
|
2026-02-17 10:03:23 -08:00
|
|
|
curl -X POST -d '' $REPORT_TV_ON
|
2024-12-26 15:19:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tv_off() {
|
|
|
|
|
cec-ctl --to 0 --standby
|
|
|
|
|
echo "off">~/scripts/PJ/tv_state
|
2026-02-17 10:03:23 -08:00
|
|
|
curl -X POST -d '' $REPORT_TV_OFF
|
2024-12-26 15:19:33 -08:00
|
|
|
}
|
2026-02-17 10:03:23 -08:00
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
source "$ROOT/.env"
|
2024-12-26 15:19:33 -08:00
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
|
if grep -q off ~/scripts/PJ/tv_state; then
|
|
|
|
|
tv_on
|
2025-06-18 13:26:52 -07:00
|
|
|
else
|
2024-12-26 15:19:33 -08:00
|
|
|
tv_off
|
|
|
|
|
fi
|
|
|
|
|
elif [[ $1 = "on" ]]; then
|
|
|
|
|
tv_on
|
|
|
|
|
elif [[ $1 = "off" ]]; then
|
|
|
|
|
tv_off
|
|
|
|
|
fi
|