Bash script to add new Xrandr mode

Aus Wiki
Wechseln zu: Navigation, Suche

I replaced a broken flat screen's LCD with a working one from another screen. Unfortunately after that, the native LCD resolution was not detected automatically anymore, so I had to configure it manually on every startup. Wrote the following script to automatically do it. You need to invoke it after X session startup.

YakumoTFT_1280x1024.sh

#!/bin/bash
 
### BEGIN INIT INFO
# Provides:          YakumoTFT
# Required-Start:    
# Required-Stop:     
# Should-Start:      
# Should-Stop:       
# Default-Start:     2
# Default-Stop:      0 1 6
# Short-Description: add mode 1280x1024
# Description:       add mode 1280x1024
### END INIT INFO
 
export DISPLAY=:0
export XAUTHORITY=/home/user/.Xauthority
 
if [ "$(xrandr | grep 1280x1024)" == '' ] && [ "$(xrandr | grep 'VGA1 disconnected')" == '' ]; then
        # use "cvt 1280 1024" to get a valid modeline for your screen
        xrandr --newmode  "1280x1024_50.00"   88.50  1280 1352 1480 1680  1024 1027 1034 1057 -hsync +vsync
        xrandr --addmode VGA1 "1280x1024_50.00"
        xrandr --output VGA1 --mode "1280x1024_50.00"
else
        echo "mode 1280x1024 already configured"
fi
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Werkzeuge