Reduce nestedness in processing of `binlist'.

Now users can use `~' instead of `$HOME' again.
This commit is contained in:
Casper Ti. Vector 2012-11-09 23:23:00 +08:00
parent 2e61a0520e
commit c63e76c680
2 changed files with 9 additions and 8 deletions

View File

@ -104,7 +104,7 @@ else
# Display selection dialog.
binindex=$(
DIALOGRC="$dialogrc" dialog --colors --stdout \
--backtitle "${longname} v${ver}" \
--backtitle "$longname v$ver" \
--ok-label ' Select ' --cancel-label ' Exit ' \
--menu 'Select session' 0 0 0 "${menu[@]}"
)
@ -116,7 +116,7 @@ fi
# Run $bin according to its flag.
let binindex-=countfrom
bin="${binlist[${binindex}]}"
bin=($(eval echo "${binlist[${binindex}]}"))
case ${flaglist[$binindex]} in
# *C*onsole programs.
[Cc])
@ -132,7 +132,7 @@ case ${flaglist[$binindex]} in
# ignore SIGINT, which is rather confusing, and cannot be undone.
trap - SIGINT SIGTSTP
CDM_SPAWN=$$ exec $bin
CDM_SPAWN=$$ exec "${bin[@]}"
;;
# *X* programs.
@ -175,7 +175,8 @@ case ${flaglist[$binindex]} in
serverargs=(":${display}" "${serverargs[@]}" "vt$vt")
$(yesno consolekit) && launchflags=(-c -t "$cktimeout")
if cdm-xlaunch "${launchflags[@]}" -- "$bin" -- "${serverargs[@]}"; then
if cdm-xlaunch "${launchflags[@]}" -- "${bin[@]}" -- "${serverargs[@]}"
then
exitnormal
else
warn "\`cdm-xlaunch' exited unsuccessfully."

View File

@ -8,10 +8,10 @@
#
# (An example:)
# binlist=(
# "$HOME/.xsession" # Launch your X session,
# '/bin/bash --login' # or just execute your shell,
# '/usr/bin/fbterm' # or start a frame buffer console,
# "/usr/bin/cdm $HOME/.submenu.cdmrc" # or go to a submenu :)
# '~/.xsession' # Launch your X session,
# '/bin/bash --login' # or just execute your shell,
# '/usr/bin/fbterm' # or start a frame buffer console,
# '/usr/bin/cdm ~/.submenu.cdmrc' # or go to a submenu :)
# )
# List all program display names, one-by-one matched with $binlist.