~ubuntu-branches/ubuntu/precise/kde-workspace/precise-security

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
#
# A script that is called from startkde. Does early setup of a configuration
# saved by krandr.

if test "$krandrrc_display_applyonstartup" = "true"; then
    if test -n "$krandrrc_display_startupcommands"; then
        # new way of simply storing the commands
        eval "$krandrrc_display_startupcommands"
    else
        # backwards compatibility
        # 4 screens is hopefully enough
        for scrn in 0 1 2 3; do
            args=
            width="\$krandrrc_screen${scrn}_width" ; eval "width=$width"
            height="\$krandrrc_screen${scrn}_height" ; eval "height=$height"
            if test -n "${width}" -a -n "${height}"; then
                args="$args -s ${width}x${height}"
            fi
            refresh="\$krandrrc_screen${scrn}_refresh" ; eval "refresh=$refresh"
            if test -n "${refresh}"; then
                args="$args -r ${refresh}"
            fi
            rotation="\$krandrrc_screen${scrn}_rotation" ; eval "rotation=$rotation"
            if test -n "${rotation}"; then
                case "${rotation}" in
                    0)
                        args="$args -o 0"
                        ;;
                    90)
                        args="$args -o 1"
                        ;;
                    180)
                        args="$args -o 2"
                        ;;
                    270)
                        args="$args -o 3"
                        ;;
                esac
            fi
            reflectx="\$krandrrc_screen${scrn}_reflectx" ; eval "reflectx=$reflectx"
            if test "${refrectx}" = "true"; then
                args="$args -x"
            fi
            reflecty="\$krandrrc_screen${scrn}_reflecty" ; eval "reflecty=$reflecty"
            if test "${refrecty}" = "true"; then
                args="$args -y"
            fi
            if test -n "$args"; then
                xrandr $args
            fi
        done
    fi
fi