File: sdm-wm

package info (click to toggle)
sdm 0.4.0a-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 188 kB
  • ctags: 4
  • sloc: sh: 68; makefile: 66
file content (67 lines) | stat: -rwxr-xr-x 1,571 bytes parent folder | download
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
#!/bin/sh
#/usr/bin/sdm-wm

# selects window manager using Xdialog and debian alternatives 
# system

# TODO support window managers not in the debian alternatives 
# system

if [ -r ~/.sdmrc ]; then
  . ~/.sdmrc
fi

# check the debian alternatives system for available window managers
availablewm=$(/usr/sbin/update-alternatives --display \
  x-window-manager | awk '{print $1}' | egrep bin)

if [ -r /etc/sdm/windowmanagers ]; then
  availablewm="$availablewm $(egrep -v ^# /etc/sdm/windowmanagers | awk -F "=" '{print $2}')"
fi

wmlist=
for wm in $availablewm; do
  if [ -x "$wm" ]; then
    wmlist="$(basename $wm) $wm off $wmlist"
  fi
done

if [ -n "$(which wmanager)" ]; then
  wmanager="wmanager $(which wmanager) off"
fi

if [ -n "$(which selectwm)" ]; then
  selectwm="selectwm $(which selectwm) off"
fi

windowmanager=$(Xdialog --stdout --radiolist \
  "which window manager would you like to try?" 0 0 0 \
  default "default window manager" on \
  $wmlist \
  $wmanager \
  $selectwm \
  sdm-wm "sdm window manager selection" off \
  browse "browse for window manager" off)

if [ "0" != "$?" ]; then
  xmessage -center "cancel pressed, exiting..."
  exit 1
fi

if [ "browse" = "$windowmanager" ]; then
  windowmanager=$(Xdialog --stdout --fselect "/usr/bin" 0 0)
  if [ ! -x "$windowmanager" ]; then
    windowmanager=
  fi
fi

Xdialog --yesno "Would you like to set $windowmanager as your \
  default window manager?" 0 0

if [ "0" = "$?" ]; then
  echo "windowmanager=$windowmanager" > ~/.sdmrc
fi

if [ "sdm-wm" = "$windowmanager" ]; then
  exec sdm-wm
fi