X-Git-Url: https://git.madduck.net/etc/tmux.git/blobdiff_plain/1b3743469547cb3d91ae0d789df8714af7e96301..HEAD:/.bin/mtmux?ds=inline diff --git a/.bin/mtmux b/.bin/mtmux index bee0bc8..a40bd12 100755 --- a/.bin/mtmux +++ b/.bin/mtmux @@ -29,6 +29,7 @@ err() { exit $exitcode } +cmds= for i in "$@"; do case "${state:-}:$i" in (:-c) state=cwd;; @@ -49,7 +50,10 @@ for i in "$@"; do state= ;; - (:--) shift; set -- "$@"; break + (:--) shift; set -- "$@"; break;; + + (:\;) cmds="$cmds \;";; + (:*) cmds="${cmds:+$cmds }$i";; esac shift 2>/dev/null || break done @@ -61,7 +65,7 @@ if [ -n "${window:-}" ]; then warn "Both -w and -c don't make sense, ignoring -c" cwd= fi - if [ -n "$@" ]; then + if [ -n "$*" ]; then warn "Ignoring commands specified with -w" set -- fi @@ -69,18 +73,19 @@ if [ -n "${window:-}" ]; then err 1 "Missing option -n, required with -w" fi - args="new -t $name \; select-window -t $window" + args="new -t $name \;${cmds:+ $cmds \;} select-window -t $window" else - subcmd="new${name:+ -s $name}" + subcmd="set -g monitor-bell off \; new${name:+ -s $name}" for i in "$@" +; do case "$i" in (*:) wname="${i%:}";; (+|.|\;) - args="${args}${subcmd}${cwd:+ -c $cwd}${wname:+ -n $wname}${cmd:-} \\; " + args="${args}${subcmd}${cwd:+ -c $cwd}${wname:+ -n $wname}${cmd:-} \; " + args="$args${cmds:+$cmds \; }" subcmd="neww -d" - cmd= + cmd= cmds= ;; (*) cmd="${cmd:-} $i";; esac