/
pick-wm
executable file
·52 lines (41 loc) · 1.87 KB
/
pick-wm
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
#!/bin/bash
VERSION="cream-0.1" # updated for cream
# WMLIST='/usr/bin/wmlist' # name of the wm list file; last entry should be 'POWEROFF'
README="$HOME/README" # name of the readme file
RELEASE="Cream"
# the list of window managers can be read from a file, one line at a time
# alist=($(cat $WMLIST))
# or set here inside the script. either way the last entry should always be POWEROFF
alist=( README tmux 2bwm 2wm 9wm aewm afterstep alopex amiwm antiwm awesome blackbox bspwm catwm clfswm ctwm cwm dminiwm dragonflywm dwm echinus \
euclid-wm evilpoison evilwm fluxbox flwm fvwm-crystal goomwwm hcwm herbstluftwm i3 icewm jwm karmen larswm lwm matwm2 mcwm monsterwm \
musca notion nwm olwm openbox oroborus pekwm ratpoison sapphire sawfish sithwm smallwm snapwm spectrwm stumpwm subtle tinywm tritium twm \
uwm vtwm w9wm weewm wind windowlab wm2 wmaker wmfs wmii wmx xfwm4 xmonad xoat yeahwm POWEROFF )
let num=${#alist[*]}-1 # number of items in the array (minus one to account for zero index)
tmpfile=$(mktemp) # make a temp file for dialog return value
# make a list in menu format, with a number first, then the name
for i in $(seq 0 $num); do
blist[i]=$(echo $i ${alist[i]})
done
while true; do
# display the list in a dialog, save the return value (the index number) in the tmpfile
dialog --backtitle "LinuxBBQ $RELEASE" --no-tags --menu 'please choose a window manager' 50 50 50 ${blist[*]} 2>$tmpfile
[[ $? = 1 ]] && exit # user chose "cancel"
chosen=$(<$tmpfile) # get the index from the tmpfile
# index into the WM array to get the name of the WM
wm=${alist[$chosen]}
case $wm in
README )
clear
less $README
;;
tmux )
tmux
;;
POWEROFF )
sudo poweroff
;;
* )
xinit $wm
;;
esac
done