| Autoconfiguring dual monitors on UbuntuPosted on July 14, 2009 by Mikko OhtamaaFiled Under technology, ubuntu The following shell script is a helper script for laptop users who connect an external monitor now and then to their laptop. Since Ubuntu does not provide clever ways to arrange desktop or detect connected displays, you need to run the script from terminal when you change your monitor configuration.
It is based on disper tool by Willem van Engen. For now (2009), it’s nVidia only. ATI support could be possible. #!/bin/sh
#
# Detect displays and move panels to the primary display
#
# Copyright 2009 Twinapex Research
#
# Author <mikko.ohtamaa@twinapex.com>
#
# disper command will detect and configure monitors
disper --displays=auto -e
# parse output from disper tool how many displays we have attached
# disper prints 2 lines per displer
lines=`disper -l|wc -l`
display_count=$((lines / 2))
echo $display_count
echo "Detected display count:" $display_count
# Make sure that we move panels to the correct display based
# on the display count
if [ $display_count = 1 ] ; then
echo "Moving panels to the internal LCD display"
gconftool-2 \
--set "/apps/panel/toplevels/bottom_panel_screen0/monitor" \
--type integer "0"
gconftool-2 \
--set "/apps/panel/toplevels/top_panel_screen0/monitor" \
--type integer "0"
else
echo "Moving panels to the external display"
gconftool-2 \
--set "/apps/panel/toplevels/bottom_panel_screen0/monitor" \
--type integer "1"
gconftool-2 \
--set "/apps/panel/toplevels/top_panel_screen0/monitor" \
--type integer "1"
fi
|
