I've installed XBMCbuntu 12.00 (Intel/nVidia) on my laptop Acer Aspire 5920G with nVidia 8600GM graphics card. I would like to be able to toggle my output display between any monitor that I connect (D-SUB or HDMI) and the native laptop display, on a specified key press. So I've created the following script (since disper doesn't work):
I assigned this script to the XF86Launch1 button and worked with 3 different displays under the Openbox environment. Under the session XBMC I tried executing this script with the System.Exec through the Commands plugin but it doesn't work. I seems that when the XBMC is running in fullscreen the video output is working different than running it in window mode.
Could someone please help me correcting the above script to be able to toggle displays when running in fullscreen. And also I would like to know if I can somehow assign a shell script to be executed on a specified key instead of the Commands plugin (when running in fullscreen the Openbox bindings do not work).
Thanks in advance!
Code:
## bash
nativeoutput="LVDS-0"
nativescreensize="1280x800"
screencount=`xrandr | grep -c "[^dis]connected"`
## First change the output of the monitor
## depending on the connected monitors
if [ $screencount -eq 2 ]
then
currentscreensize=`xrandr | grep "[^dis]connected.*[0-9]\+x[0-9]\+" | grep -o "[0-9]\+x[0-9]\+"`
connectedoutput=`xrandr | grep "[^dis]connected" | awk '{print $1}' | grep -v $nativeoutput`
connectedscreensize=`xrandr | grep -A 1 $connectedoutput | grep \+ | awk '{print $1}'`
## This operates as a switch between the 2 monitors
if [ $currentscreensize != $nativescreensize ]
then
echo Changing output to laptop monitor
xrandr --output $nativeoutput --mode $nativescreensize --output $connectedoutput --off
else
echo Changing output to connected monitor
xrandr --output $nativeoutput --off --output $connectedoutput --mode $connectedscreensize
fi
else
echo No display connected!
fi
I assigned this script to the XF86Launch1 button and worked with 3 different displays under the Openbox environment. Under the session XBMC I tried executing this script with the System.Exec through the Commands plugin but it doesn't work. I seems that when the XBMC is running in fullscreen the video output is working different than running it in window mode.
Could someone please help me correcting the above script to be able to toggle displays when running in fullscreen. And also I would like to know if I can somehow assign a shell script to be executed on a specified key instead of the Commands plugin (when running in fullscreen the Openbox bindings do not work).
Thanks in advance!