CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/packages/bsp/rockchip/hdmi-hotplug
Views: 3960
#!/usr/bin/env bash
USER="$(who | grep :0\) | cut -f 1 -d ' ')"
export XAUTHORITY=/home/$USER/.Xauthority
export DISPLAY=:0
HDMI_STATUS="$(cat /sys/class/drm/card0-HDMI-A-1/status)"

# Check to see if HDMI connected or not and toggle if change
if [ "${HDMI_STATUS}" = connected ]; then
	xrandr
	xrandr --output HDMI-1 --auto
else
	xrandr --output HDMI-1 --off
fi

exit 0