Skip to content

Instantly share code, notes, and snippets.

@dd-han
Last active December 17, 2016 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dd-han/8da5d11531cddd89e5f84d348177f988 to your computer and use it in GitHub Desktop.
Save dd-han/8da5d11531cddd89e5f84d348177f988 to your computer and use it in GitHub Desktop.
lightDM moniter setup
#!/bin/sh
DEFAULT="LVDS1"
moniters=`xrandr | grep connected | sed 's/ted.*/ted/g' | sed 's/ /-/g'`
for monit in $moniters; do
if grep $DEFAULT <<< $monit > /dev/null; then
if grep "disconnected" <<< $monit > /dev/null; then
echo "LVDS not connect, big problem, skip setting" >> /tmp/dm.log
exit 0
else
echo "LVDS exist, use LVDS" >> /tmp/dm.log
fi
fi
done
for monit in $moniters; do
if grep "\-connected" <<< $monit > /dev/null && grep -v $DEFAULT <<< $monit > /dev/null; then
echo "external moniter $monit connect, tempory off" >> /tmp/dm.log
xrandr --output `sed 's/-.*//g' <<< $monit` --right-of $DEFAULT --auto
fi
done
@dd-han
Copy link
Author

dd-han commented Oct 15, 2016

use for setup moniter on LightDM while two or more monitor connect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment