Difference between revisions of "Talk:Fglrx"

From ThinkWiki
Jump to: navigation, search
 
(Display switching script)
Line 2: Line 2:
  
 
--[[User:Micampe|Micampe]] 21:39, 14 Dec 2005 (CET)
 
--[[User:Micampe|Micampe]] 21:39, 14 Dec 2005 (CET)
 +
 +
Hi,
 +
I wrote a shell script for display switching. I use it under Ubuntu Dapper Drake. As I don't have a CRT, any feedback is welcome.
 +
 +
Create {{path|/etc/acpi/events/ibm-videobtn}}:
 +
<pre>
 +
# /etc/acpi/events/ibm-videobtn
 +
# This is called when the user presses the video button.
 +
 +
event=ibm/hotkey HKEY 00000080 00001007
 +
action=/etc/acpi/ibm-video.sh
 +
</pre>
 +
 +
Create {{path|/etc/acpi/ibm-video.sh}} with permissions 755:
 +
<pre>
 +
#!/bin/sh
 +
 +
. /etc/default/acpi-support
 +
. /usr/share/acpi-support/power-funcs
 +
 +
getXconsole;
 +
 +
change_resolution() {
 +
        if [ x"$XAUTHORITY" != x"" ]; then
 +
                if [ x"`xrandr -q | grep $1[[:space:]]x[[:space:]]$2 | cut -b -1`" != x"*" ]; then
 +
                        xrandr -d $DISPLAY -s $1x$2
 +
                fi
 +
        fi
 +
}
 +
 +
change_monitor() {
 +
        if [ x"$XAUTHORITY" != x"" ]; then
 +
                su $user -c "aticonfig --enable-monitor=$1" &>/dev/null
 +
        fi
 +
}
 +
 +
if [ x"$XAUTHORITY" != x"" ]; then
 +
        CURRENT=`aticonfig --query-monitor | grep Enabled | cut -b 21-`
 +
        case $CURRENT in
 +
                lvds)
 +
                        CURRENT="LCD only"
 +
                        ;;
 +
                crt1)
 +
                        CURRENT="CRT only"
 +
                        ;;
 +
                lvds,\ crt1)
 +
                        CURRENT="LCD and CRT"
 +
                        ;;
 +
                tv)
 +
                        CURRENT="TV-Out only"
 +
                        ;;
 +
                lvds,\ tv)
 +
                        CURRENT="LCD and TV-Out"
 +
                        ;;
 +
                crt1,\ tv)
 +
                        CURRENT="CRT and TV-Out"
 +
                        ;;
 +
        esac
 +
 +
        CHOICE=`su $user -c "zenity --width=300 --height=350 --window-icon=/usr/share/pixmaps/ati.xpm \
 +
        --title 'Video output switcher' \
 +
        --text='Choose the video output\n\nCurrent setting: $CURRENT\n' \
 +
        --list --radiolist --column 'x' --column 'video output' \
 +
        true 'LCD only' \
 +
        false 'CRT only' \
 +
        false 'LCD and CRT' \
 +
        false 'TV-Out only' \
 +
        false 'LCD and TV-Out' \
 +
        false 'CRT and TV-Out'"`
 +
fi
 +
 +
case $CHOICE in
 +
        LCD\ only)
 +
                change_monitor lvds
 +
                change_resolution 1400 1050
 +
                ;;
 +
        CRT\ only)
 +
                change_monitor crt1
 +
                change_resolution 1280 1024
 +
                ;;
 +
        LCD\ and\ CRT)
 +
                change_monitor lvds,crt1
 +
                change_resolution 1280 1024
 +
                ;;
 +
        TV-Out\ only)
 +
                change_monitor tv
 +
                change_resolution 1024 768
 +
                ;;
 +
        LCD\ and\ TV-Out)
 +
                change_monitor lvds,tv
 +
                change_resolution 1024 768
 +
                ;;
 +
        CRT\ and\ TV-Out)
 +
                change_monitor crt1,tv
 +
                change_resolution 1024 768
 +
                ;;
 +
esac
 +
</pre>
 +
 +
--[[User:Whoopie|Whoopie]] 16:28, 25 May 2006 (CEST)

Revision as of 16:28, 25 May 2006

So, I'm searching up and down and there seems to be no way to enable the TV output without an ad-hoc xorg.conf. So my question is, what is fireglcontrolpanel useful for?

--Micampe 21:39, 14 Dec 2005 (CET)

Hi, I wrote a shell script for display switching. I use it under Ubuntu Dapper Drake. As I don't have a CRT, any feedback is welcome.

Create /etc/acpi/events/ibm-videobtn:

# /etc/acpi/events/ibm-videobtn
# This is called when the user presses the video button.

event=ibm/hotkey HKEY 00000080 00001007
action=/etc/acpi/ibm-video.sh

Create /etc/acpi/ibm-video.sh with permissions 755:

#!/bin/sh

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

getXconsole;

change_resolution() {
        if [ x"$XAUTHORITY" != x"" ]; then
                if [ x"`xrandr -q | grep $1[[:space:]]x[[:space:]]$2 | cut -b -1`" != x"*" ]; then
                        xrandr -d $DISPLAY -s $1x$2
                fi
        fi
}

change_monitor() {
        if [ x"$XAUTHORITY" != x"" ]; then
                su $user -c "aticonfig --enable-monitor=$1" &>/dev/null
        fi
}

if [ x"$XAUTHORITY" != x"" ]; then
        CURRENT=`aticonfig --query-monitor | grep Enabled | cut -b 21-`
        case $CURRENT in
                lvds)
                        CURRENT="LCD only"
                        ;;
                crt1)
                        CURRENT="CRT only"
                        ;;
                lvds,\ crt1)
                        CURRENT="LCD and CRT"
                        ;;
                tv)
                        CURRENT="TV-Out only"
                        ;;
                lvds,\ tv)
                        CURRENT="LCD and TV-Out"
                        ;;
                crt1,\ tv)
                        CURRENT="CRT and TV-Out"
                        ;;
        esac

        CHOICE=`su $user -c "zenity --width=300 --height=350 --window-icon=/usr/share/pixmaps/ati.xpm \
        --title 'Video output switcher' \
        --text='Choose the video output\n\nCurrent setting: $CURRENT\n' \
        --list --radiolist --column 'x' --column 'video output' \
        true 'LCD only' \
        false 'CRT only' \
        false 'LCD and CRT' \
        false 'TV-Out only' \
        false 'LCD and TV-Out' \
        false 'CRT and TV-Out'"`
fi

case $CHOICE in
        LCD\ only)
                change_monitor lvds
                change_resolution 1400 1050
                ;;
        CRT\ only)
                change_monitor crt1
                change_resolution 1280 1024
                ;;
        LCD\ and\ CRT)
                change_monitor lvds,crt1
                change_resolution 1280 1024
                ;;
        TV-Out\ only)
                change_monitor tv
                change_resolution 1024 768
                ;;
        LCD\ and\ TV-Out)
                change_monitor lvds,tv
                change_resolution 1024 768
                ;;
        CRT\ and\ TV-Out)
                change_monitor crt1,tv
                change_resolution 1024 768
                ;;
esac

--Whoopie 16:28, 25 May 2006 (CEST)