Last active
June 10, 2019 02:27
-
-
Save DerBunman/bb2f155b8506e356aabb3e8a519d9fc0 to your computer and use it in GitHub Desktop.
setup environment based on a connected display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place in /usr/share/gdm/greeter/autostart/setup-tv.desktop | |
[Desktop Entry] | |
Type=Application | |
Name=Setup TV | |
Exec=/home/ichi/bin/setup_tv.zsh | |
NoDisplay=true | |
X-GNOME-AutoRestart=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [ "$(md5sum /sys/class/drm/card0-HDMI-A-1/edid)" = "82e44c737eaede4d7e947d1579d24474 /sys/class/drm/card0-HDMI-A-1/edid" ]; then | |
echo "Identified the Samsung TV in the bedroom" | |
# set underscan | |
xrandr --output HDMI-0 --set underscan on | |
xrandr --output HDMI-0 --set "underscan hborder" 48 --set "underscan vborder" 24 | |
# disable laptop display | |
xrandr --output VGA-0 --off --output LVDS --off --output HDMI-0 --primary --mode 1920x1080 --pos 118x184 --rotate normal | |
# set a dpi of 200 so everything scales so I can see it from the couch | |
tmp="$(mktemp)" | |
echo "Xft.dpi: 200" > "$tmp" | |
xrdb -merge "$tmp" | |
notify-send hello "from tv" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment