diff --git a/add_user.sh b/add_user.sh index 6945007..79e4447 100755 --- a/add_user.sh +++ b/add_user.sh @@ -47,21 +47,19 @@ bind -n F1 select-window -t 0 bind -n F2 select-window -t 1 bind -n F3 select-window -t 2 bind -n F12 detach + +if-shell "tmux has-session -t main 2>/dev/null" "detach" \ + "new-session -d -s main -n Mail 'neomutt'; \ + new-window -t main:1 -n IRC 'weechat'; \ + new-window -t main:2 -n Shell 'ash'; \ + send-keys -t main:2 '/usr/local/bin/tylda-motd.sh' C-m; \ + select-window -t main:0" + EOF cat << EOF > /home/$LOGIN/.profile -if [ -z "$TMUX" ]; then - if ! tmux has-session -t main 2>/dev/null; then - tmux new-session -d -s main -n Mail 'neomutt' - tmux new-window -t main:1 -n IRC 'weechat' - tmux new-window -t main:2 -n Shell 'ash' - fi - - # Uruchom motd tylko gdy user wchodzi do Shell – okno 2 - tmux send-keys -t main:2 '/usr/local/bin/tylda-motd.sh' C-m - - tmux select-window -t main:0 - exec tmux attach-session -t main +if [ -z "\$TMUX" ]; then + tmux attach -t main || exec tmux new -s main fi EOF