Skip to content

Instantly share code, notes, and snippets.

@dayne
Last active November 18, 2019 22:55
Show Gist options
  • Save dayne/8ae99d2f1b18e8c91ab1aca1b4a6b000 to your computer and use it in GitHub Desktop.
Save dayne/8ae99d2f1b18e8c91ab1aca1b4a6b000 to your computer and use it in GitHub Desktop.
t3 screen hotfix
#!/bin/bash
REP_FILE='/usr/share/dispsetup.sh'
AUTOLAUNCH='/etc/xdg/lxsession/LXDE-pi/autostart'
echo "T3 screen hotfix script starting"
sleep 1
if [ -f $REP_FILE.orig ]; then
echo "found $REP_FILE.orig - skipping application of t3 screen hot fix"
sleep 1
else
echo "hotfix not yet applied"
echo "backing up $REP_FILE as $REP_FILE.orig"
sudo cp $REP_FILE $REP_FILE.orig
sleep 1
cat > /tmp/rep_file.sh << EOL
#!/bin/sh
export DISPLAY=:0
xrandr --newmode "1280x800_60.00" 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync
xrandr --addmode HDMI-1 1280x800_60.00
xrandr --addmode HDMI-2 1280x800_60.00
xrandr --output HDMI-1 --mode 1280x800_60.00 --pos 0x0
xrandr --output HDMI-2 --mode 1280x800_60.00 --pos 0x0
EOL
chmod +x /tmp/rep_file.sh
echo "putting hotfix $REP_FILE in place"
sudo cp /tmp/rep_file.sh $REP_FILE
sleep 1
fi
echo grep $REP_FILE $AUTOLAUNCH
grep $REP_FILE $AUTOLAUNCH 2>&1 /dev/null
if [ $? -eq 1 ]; then
echo "hotfix autolaunch applied -- applying"
sudo echo "@$REP_FILE" >> $AUTOLAUNCH
sleep 1
else
echo "hotfix already setup for autolaunch - skipping"
sleep 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment