summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/set_windowmanager.sh
blob: b159fbfcda1c5754efc72060334f91c102617f85 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
#  Script to change the windowmanger used when starting the frontend.
#  If a style is given, it will change  which & how programs will start.
#
#
windowmanager="$1"
style="$2"
configdir=/usr/share/wm_data


function outmsg(){
    echo
    echo "Changing windowmanger to $1"
    }

function stylemsg(){
    echo "Startup path will use $1 style"
    }

function set_wm(){
    case ${windowmanager} in

        default)
            outmsg "default/fluxbox"
            outline="default"
            echo "" > /etc/X11/WINDOWMANAGER
            ;;

        enlightenment)
            outmsg "enlightenment"
            outline="e16 -P $configdir/e16_config_dir/"
            ;;

        windowmaker)
            outmsg "window maker"
            outline_2="export GNUSTEP_USER_ROOT=$configdir/GNUstep"
            outline="wmaker"
            ;;

        *)
            outline=$windowmanager
            outmsg "$outline"
            ;;

    esac



    case ${style} in

        enhanced)
            STYLE="enhanced"
            HSTYLE="1"
            stylemsg enhanced
            myth_settings_wrapper.sh  -c load -t custom 1 HOSTSupplemental
            ;;

        *)
            if [ x$style != x ]
            then
               stylemsg "** Unknown style..using default"
               STYLE=""
            else
               STYLE="$style"
               stylemsg "Default"
            fi
            HSTYLE=0
            ;;
    esac



    echo WM=\"${outline}\" > /etc/X11/WINDOWMANAGER
    echo "STARTUP_STYLE=$STYLE" >>  /etc/X11/WINDOWMANAGER
    echo ${outline_2}  >>  /etc/X11/WINDOWMANAGER

    myth_settings_wrapper.sh  -c load -t custom "${windowmanager}" HostWindowManager
    myth_settings_wrapper.sh  -c load -t custom "${HSTYLE}" HostEnhancedWMStyle


    }


if [ x$windowmanager = x ]
then
    echo
    echo "Usage: "
    echo "    set_windowmanager.sh  WINDOWMANAGER STARTUP_STYLE"
    echo
    echo "Valid WINDOWMANAGER options are:"
    echo "      default"
    echo "      enlightenment"
    echo "      fluxbox"
    echo "      windowmaker"
    echo "      place_custom_startup_here"
    echo
    echo "Valid STARTUP_STYLE options are:"
    echo "      default"
    echo "      enhanced"
    echo
    echo "If STARTUP_STYLE is not given, then the default will be used."
    echo
    echo "Example:    "
    echo "    set_windowmanager.sh  enlightenment enhanced"
    echo
    echo " "
    echo "if using enlightenment or windowmaker, please ensure that the alt_wm group is installed"
    echo "pacman -Sy alt_wm"

    exit 0
fi

set_wm

if [ x$outline = "xdefault" ]
then
    exit 0
fi

WM_CHECK=`echo $outline|cut -d" " -f1 |tr -dc '[:alnum:]'`
which $WM_CHECK 2>/dev/null
rc=$?
if [ $rc != 0 ]
then
    echo "  ***Window manager $WM_CHECK does not look like it is present"
    echo "  ***setting windowmanger to windowmaker"
    echo "   "
    windowmanager="windowmaker"
    set_wm
fi