Appendix b – dual-head.sh, Appendix b – dual­head.sh – Acer 3400LMI User Manual

Page 46

Advertising
background image

F8­x86_64 on the Acer Ferrari 3400LMi

Appendix B – dual­head.sh

#!/bin/bash

#
# Available at http://ferrari.databa.se/3400/f8/dual­head.sh

#
# A script to manipulate connected graphical outputs,

# including TV­out. It includes the most common operations
# and may also be configured to run on an XF86Display event.

# Typically Fn­F5 or similar on a laptop.
#

# Prerequisites:
# This script will work with one graphics card only.

# Furthermore it will only work with two CRTCs,
# i.e. two outputs may be simultaneous active.

#
# Comments:

# In order to optimize performance and minimize flicker
# xrandr is at most called twice. Once to read the current

# state and once for setting the new state. Thus, some code
# may look strange at the first glance.

#
# By Sven­Göran Bergh, 2008­01­01

#

### Edit user settings here: ######################################
                       #

DEFAULTACTION="toggle" # May be changed with argument 1
DEFAULTSIDE="left"     # May be changed with argument 2

                       #
###################################################################

### Edit hardware specific settings here: #########################

                       #
INTERNAL="LVDS"        # Specify the name of the internal display

TVOUTPUT="S­video"     # Specify the name of the TV­output
TVMODE="pal"           # Specify TV mode, PAL or NTSC

                       #
###################################################################

# Get X user

#XUSER=$(w | awk '$3 ~ /^:[0­9]$/ {print $1; nextfile}')

# Get X display (current or first running)
DISPLAY=${DISPLAY:= \

    $( w | awk '$3 ~ /^:[0­9]$/ {print $3; nextfile}' )}

# Quit if no X­server is running
[ "${DISPLAY}" ] || exit 1

46

Advertising