From c63e76c6802a101f6a854393cd407982a1c5aeb3 Mon Sep 17 00:00:00 2001 From: "Casper Ti. Vector" Date: Fri, 9 Nov 2012 23:23:00 +0800 Subject: [PATCH] Reduce nestedness in processing of `binlist'. Now users can use `~' instead of `$HOME' again. --- src/cdm | 9 +++++---- src/cdmrc | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cdm b/src/cdm index 39ac56b..6c0b529 100755 --- a/src/cdm +++ b/src/cdm @@ -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." diff --git a/src/cdmrc b/src/cdmrc index 8db1fd7..07ef72f 100644 --- a/src/cdmrc +++ b/src/cdmrc @@ -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.