~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/randr/krandrstartup

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# A script that is called from startkde. Does early setup of a configuration
 
4
# saved by krandr.
 
5
 
 
6
if test "$krandrrc_display_applyonstartup" = "true"; then
 
7
    if test -n "$krandrrc_display_startupcommands"; then
 
8
        # new way of simply storing the commands
 
9
        eval "$krandrrc_display_startupcommands"
 
10
    else
 
11
        # backwards compatibility
 
12
        # 4 screens is hopefully enough
 
13
        for scrn in 0 1 2 3; do
 
14
            args=
 
15
            width="\$krandrrc_screen${scrn}_width" ; eval "width=$width"
 
16
            height="\$krandrrc_screen${scrn}_height" ; eval "height=$height"
 
17
            if test -n "${width}" -a -n "${height}"; then
 
18
                args="$args -s ${width}x${height}"
 
19
            fi
 
20
            refresh="\$krandrrc_screen${scrn}_refresh" ; eval "refresh=$refresh"
 
21
            if test -n "${refresh}"; then
 
22
                args="$args -r ${refresh}"
 
23
            fi
 
24
            rotation="\$krandrrc_screen${scrn}_rotation" ; eval "rotation=$rotation"
 
25
            if test -n "${rotation}"; then
 
26
                case "${rotation}" in
 
27
                    0)
 
28
                        args="$args -o 0"
 
29
                        ;;
 
30
                    90)
 
31
                        args="$args -o 1"
 
32
                        ;;
 
33
                    180)
 
34
                        args="$args -o 2"
 
35
                        ;;
 
36
                    270)
 
37
                        args="$args -o 3"
 
38
                        ;;
 
39
                esac
 
40
            fi
 
41
            reflectx="\$krandrrc_screen${scrn}_reflectx" ; eval "reflectx=$reflectx"
 
42
            if test "${refrectx}" = "true"; then
 
43
                args="$args -x"
 
44
            fi
 
45
            reflecty="\$krandrrc_screen${scrn}_reflecty" ; eval "reflecty=$reflecty"
 
46
            if test "${refrecty}" = "true"; then
 
47
                args="$args -y"
 
48
            fi
 
49
            if test -n "$args"; then
 
50
                xrandr $args
 
51
            fi
 
52
        done
 
53
    fi
 
54
fi