tl;dr Nothing wrong with tmux, my mistake.  tmux start-server isn't even needed 
for my use-case.

I've spent a bit of time resolving my issue and it turns out not to be tmux's 
fault at all.  I'm sorry for wasting your time.  Thank you for trying to help.

I'm going to try to explain in a bit more detail in case it helps other people. 
 Like a lot of others, I wanted a way to launch tmux sessions on login 
automatically.  That is my use-case.

The main problem I had was that konsole --tabs-from-file seems to have stopped 
working.  

I have a filed named autostart that my window manager (openbox) launches.  In 
it, I used to launch konsole like so:

tmux start-server
for i in ~/tmux_sessions/*.session; do echo $i; "$i"; done
konsole --background-mode--profile Shell --tabs-from-file 
~/tmux_sessions/work_console.tabs

work_console.tabs looked something like this:

title: email;;       command: ssh -t myserver tmux attach -t email
title: meta;;        command: tmux attach -t meta
title: project1;;    command: tmux attach -t project1
title: project2;;    command: tmux attach -t project2
...

I'm now using Terminal from xfce and I'm invoking it like so:

for i in ~/tmux_sessions/*.session; do echo $i; "$i"; done

Terminal --maximize \
          -T 'email'          -e 'ssh -t mediapc tmux attach -t email' \
    --tab -T 'meta'           -e 'tmux attach -t meta'                 \
    --tab -T 'project1'       -e 'tmux attach -t project1'             \
    --tab -T 'project2'       -e 'tmux attach -t project2'             
...

for i in $(pidof tmux); do for j in $(ps --ppid $i -o pid h); do kill -s 
SIGWINCH $j; done;  done


As a sample, the session I've called 'meta' i looks like this:
#!/bin/bash
SESSION_NAME='meta'
if [[ ! -z "$TMUX" ]] || [[ ! -z "$TMUX_PANE" ]]; then
    echo "Already inside a tmux session, do not know what to do"
    exit 1
fi
ps -C tmux > /dev/null 2>&1 # is tmux running?
if [ ! $? ]; then
    echo 'tmux needs to be running by now'
    exit 1
fi
tmux -q has-session -t "$SESSION_NAME" > /dev/null 2>&1 # this doesn't seem to 
work as I thought
if [ ! $? ]; then
    echo "$SESSION_NAME already exists"
    exit 0
fi
NEWCWD=~/tmux_sessions
( cd "$NEWCWD"; tmux new-session -d -s "$SESSION_NAME" )
tmux send-keys -t "$SESSION_NAME" 'vim meta.session' Enter
( cd "$NEWCWD"; tmux split -h -t "$SESSION_NAME" )
tmux send-keys -t "$SESSION_NAME" 'vim konsolesetup' Enter
NEWCWD=~/.config/openbox
( cd "$NEWCWD"; tmux split -t "$SESSION_NAME" )
tmux send-keys -t "$SESSION_NAME" 'vim autostart.sh' Enter
tmux select-pane -L
tmux split -t "$SESSION_NAME"
tmux send-keys -t "$SESSION_NAME" 'sudo tail -F -n 100 /var/log/messages | ccze 
--mode ansi' Enter

------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to