Skip to content

Instantly share code, notes, and snippets.

@sandorkazi sandorkazi/1920.sh
Created Sep 11, 2015

Embed
What would you like to do?
#!/bin/bash
SETUP=$1
mode="1920x1080_60.00"
modestring="173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync"
lvds=LVDS1
vga=VGA1
function purge {
xrandr --delmode "${vga}" "${mode}" >/dev/null 2>&1
xrandr --rmmode "${mode}" >/dev/null 2>&1
}
function vga_init {
xrandr --newmode "${mode}" ${modestring}
xrandr --addmode "${vga}" "${mode}"
xrandr --output "${vga}" --mode "${mode}"
}
function vga_only {
vga_init
xrandr --output "${lvds}" --off
}
function lvds_only {
xrandr --output "${lvds}" --auto
xrandr --output "${vga}" --off
xrandr --output "${lvds}" --auto
xrandr --output "${vga}" --off
}
function extend {
vga_init
xrandr --output "${lvds}" --auto
xrandr --output "${vga}" --auto
xrandr --output "${vga}" --right-of "${lvds}"
}
function mirror {
xrandr --output "${vga}" --off
xrandr --noprimary
xrandr --output "${lvds}" --primary
xrandr --output "${vga}" --auto
xrandr --output "${vga}" --same-as "${lvds}"
}
purge
if [ "${SETUP}" == "" ] ; then
vga_only
elif [ "${SETUP}" == "help" ] || [ "${SETUP}" == "?" ]; then
echo "1920.sh <mode>"
echo " mode:"
echo " help or ?: prints this help"
echo " vga_only: VGA only mode with 1920x1080 resolution"
echo " lvds_only: laptop only mode"
echo " extend: laptop and vga display"
echo " mirror: mirrored laptop to VGA"
echo " empty mode defaults to vga_only"
echo " bad mode defaults to lvds_only"
else
(${SETUP}) || lvds_only
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.