On Fri, Jan 29, 2010 at 06:56:52PM -0700, Aaron Denney wrote:
> I've gotten the proposed solution of tmux-in-tmux to work fairly well.
> For others amusement, I'm attaching the scripts I'm using. In addition,
> I have a seperate conf that unbinds the window switching in the top
> tmux, and switches its shell to "tmux-under"; similarly, my standard
> conf unbinds pane modification in the lower. In the upper I leave ^B as
> the command key, and for the lower I use ^A, though many other choices
> would, of course, work.
>
> There are a number of cleanups and improvements that could be done.
> I use the default socket names for the "under", so that they share a
> namespace with unmodified tmux. It isn't clear that this is quite the
> right thing, but it's been handy so far. It never garbage collects any
> detached session, either.
>
> Any comments?
>
> --
> Aaron Denney
> -><-
> #! /bin/sh
> exec tmux -f ~/.tmux.over.conf -L outer "$@"
> #! /bin/sh
> if echo $TMUX | grep -q -F "outer,"; then
> unset TMUX
> fi
>
> if tmux "$@" has-session; then
> unattached=$(tmux "$@" list-sessions | grep -v attached | awk '{ print $1
> }' | head -1)
>
> if [ -n "$unattached" ]; then
> exec tmux "$@" attach -t $unattached
> fi
> attached=$(tmux "$@" list-sessions | grep attached | awk '{ print $1 }' |
> head -1)
>
> exec tmux "$@" new-session -t $attached
> fi
>
> exec tmux "$@"
Sorry if this is nitpicky, but you can save two processes by putting
more logic in your awk code, e.g.:
unattached=$(tmux "$@" list-sessions | awk '!/attached/ { print $1; exit }')
...
attached=$(tmux "$@" list-sessions | awk '/attached/ { print $1; exit }')
Paul.
--
Paul Hoffman <[email protected]>
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users