projects
/
grml-quickconfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
just start X if there is only one WM installed
[grml-quickconfig.git]
/
quickconfig
/
030-wm.sh
diff --git
a/quickconfig/030-wm.sh
b/quickconfig/030-wm.sh
index
7bfcaf9
..
6a12e12
100644
(file)
--- a/
quickconfig/030-wm.sh
+++ b/
quickconfig/030-wm.sh
@@
-1,54
+1,61
@@
# window manager module for grml-quickconfig
# window manager module for grml-quickconfig
-LINE='print_line "Start
${HIGHLIGHT}x${NORMAL} (${HIGHLIGHT_NAME}grml-x${NORMAL}
)"'
+LINE='print_line "Start
^x (/grml-x/
)"'
KEY=(x)
FUNCTION='wm_menu'
display_entry() {
KEY=(x)
FUNCTION='wm_menu'
display_entry() {
- return 0
+ . /etc/grml/script-functions
+ check4progs grml-x >/dev/null
+ return $?
}
# variable definition {{{
typeset -A wms
typeset -A available
}
# variable definition {{{
typeset -A wms
typeset -A available
-set -
a
output
+set -
A
output
# }}}
# window manager definition {{{
# }}}
# window manager definition {{{
-wms[a]=awesome
-wms[d]=dwm
-wms[e]=evilwm
-wms[f]=fluxbox
-wms[v]=fvwm
-wms[2]=fvwm2
-wms[c]=fvwm-crystal
-wms[j]=jwm
-wms[o]=openbox
-wms[k]=pekwm
-wms[r]=ratpoison
-wms[t]=twm
-wms[9]=w9wm
-wms[w]=windowlab
-wms[i]=wmii
-wms[n]=wm-ng
+wms=(
+ a awesome
+ d dwm
+ e evilwm
+ f fluxbox
+ v fvwm
+ 2 fvwm2
+ c fvwm-crystal
+ 3 i3
+ j jwm
+ o openbox
+ k pekwm
+ r ratpoison
+ t twm
+ 9 w9wm
+ w windowlab
+ i wmii
+ n wm-ng
+ )
# }}}
# deteremine installed window managers {{{
print_available_wm() {
. /etc/grml/script-functions
# }}}
# deteremine installed window managers {{{
print_available_wm() {
. /etc/grml/script-functions
- line=""
LEN=0
LEN=0
+ AVAILABLE_WM_COUNT=0
+ local line
for key value in ${(kv)wms} ; do
if check4progs $value >/dev/null ; then
available[$key]=$value
# test if word could be added to current line
for key value in ${(kv)wms} ; do
if check4progs $value >/dev/null ; then
available[$key]=$value
# test if word could be added to current line
- if [ $[${(c)#key} + $LEN] -lt $MAXLEN ] ; then
- LEN+=${(c)#wm}
- line+="$(highlight_char $value $key) "
- else
+ if [ $((${(c)#value} + $LEN)) -ge $(($MAXLEN-9)) ] ; then
LEN=0
output+="$line"
LEN=0
output+="$line"
+ line=""
fi
fi
+ line+="$(highlight_char $value $key) "
+ LEN=$((${(c)#value} + $LEN))
+ AVAILABLE_WM_COUNT=$(($AVAILABLE_WM_COUNT + 1))
fi
done
output+="$line"
fi
done
output+="$line"
@@
-66,9
+73,13
@@
wm_heading() {
# print windowm manager loop {{{
wm_menu() {
# print windowm manager loop {{{
wm_menu() {
+ if [ $AVAILABLE_WM_COUNT == 1 ]; then
+ run su grml -c "grml-x"
+ return
+ fi
echo
wm_heading
echo
wm_heading
- for line in $
output
; do
+ for line in $
{output}
; do
print_line $line
done
print_closing_line
print_line $line
done
print_closing_line