Skip to content

Instantly share code, notes, and snippets.

@rafi
Created January 24, 2013 19:08
Show Gist options
  • Save rafi/4626560 to your computer and use it in GitHub Desktop.
Save rafi/4626560 to your computer and use it in GitHub Desktop.
lightdm display setup
#!/bin/bash
# V-1.0 by Hanynowsky - April 2012.
# I am a very basic script that works around bug 874241 repprted in launchpad.
XCOM0=`xrandr -q | grep 'HDMI1 connected'`
XCOM1=`xrandr --output HDMI1 --primary --mode 1920x1080 --output LVDS1 --mode 1366x768 --below HDMI1`
XCOM2=`xrandr --output LVDS1 --mode 1366x768`
# if the external monitor is connected, then we tell XRANDR to set up an extended desktop
if [ -n "$XCOM0" ] || [ ! "$XCOM0" = "" ]; then echo $XCOM1
# if the external monitor is disconnected, then we tell XRANDR to output only to the laptop screen
else echo $XCOM2
fi
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment