How can I launch a new session of tmux in iTerm2 on a separate window?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I would like to start a tmux session on a separate window in iTerm2. Now I'm writing my own configuration script to launch the session.
tmux new-session -s dev -n main -d
tmux send-keys -t dev "cd $DL" C-m
tmux split-window -h -t dev
tmux split-window -v -t dev -p 30
tmux resize-pane -x 70 -y 20
tmux attach -t dev
This starts a new session but the window is on the window I execute the script, not the new, separate window in iTerm2.
So I changed the first line (tmux new-session -s dev -n main -d
) to tmux -CC new -t dev
, but then although the session starts in a new window, it does not have the split and the resize. It seems to only open the new session in a new window and that's all.
How can I make it launched in a new window with all the initial settings including the directory change, split window, etc...?
tmux session iterm2
add a comment |Â
up vote
0
down vote
favorite
I would like to start a tmux session on a separate window in iTerm2. Now I'm writing my own configuration script to launch the session.
tmux new-session -s dev -n main -d
tmux send-keys -t dev "cd $DL" C-m
tmux split-window -h -t dev
tmux split-window -v -t dev -p 30
tmux resize-pane -x 70 -y 20
tmux attach -t dev
This starts a new session but the window is on the window I execute the script, not the new, separate window in iTerm2.
So I changed the first line (tmux new-session -s dev -n main -d
) to tmux -CC new -t dev
, but then although the session starts in a new window, it does not have the split and the resize. It seems to only open the new session in a new window and that's all.
How can I make it launched in a new window with all the initial settings including the directory change, split window, etc...?
tmux session iterm2
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to start a tmux session on a separate window in iTerm2. Now I'm writing my own configuration script to launch the session.
tmux new-session -s dev -n main -d
tmux send-keys -t dev "cd $DL" C-m
tmux split-window -h -t dev
tmux split-window -v -t dev -p 30
tmux resize-pane -x 70 -y 20
tmux attach -t dev
This starts a new session but the window is on the window I execute the script, not the new, separate window in iTerm2.
So I changed the first line (tmux new-session -s dev -n main -d
) to tmux -CC new -t dev
, but then although the session starts in a new window, it does not have the split and the resize. It seems to only open the new session in a new window and that's all.
How can I make it launched in a new window with all the initial settings including the directory change, split window, etc...?
tmux session iterm2
I would like to start a tmux session on a separate window in iTerm2. Now I'm writing my own configuration script to launch the session.
tmux new-session -s dev -n main -d
tmux send-keys -t dev "cd $DL" C-m
tmux split-window -h -t dev
tmux split-window -v -t dev -p 30
tmux resize-pane -x 70 -y 20
tmux attach -t dev
This starts a new session but the window is on the window I execute the script, not the new, separate window in iTerm2.
So I changed the first line (tmux new-session -s dev -n main -d
) to tmux -CC new -t dev
, but then although the session starts in a new window, it does not have the split and the resize. It seems to only open the new session in a new window and that's all.
How can I make it launched in a new window with all the initial settings including the directory change, split window, etc...?
tmux session iterm2
asked Jul 4 at 20:51
Blaszard
121117
121117
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can use applescript to do something like this:
$ cat a.bash
#!/bin/bash
osascript - "$@" <<EOF
on run argv
tell application "iTerm"
activate
set new_term to (create window with default profile)
tell new_term
tell the current session
repeat with arg in argv
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
This provides a script which can then pass arguments passed into it, into another iterm2 terminal.
For example:
$ ./a.bash "echo 'hello iterm2'"
  Â
References
- https://stackoverflow.com/questions/32675804/how-do-i-execute-a-command-in-an-iterm-window-from-the-command-line
Thanks but how can I take the script to the argument of thea.bash
?./a.bash < my_script
does not work (it only launches the window). It works if it is./a.bash "tmux new -s dev"
, though.
â Blaszard
Jul 5 at 11:26
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can use applescript to do something like this:
$ cat a.bash
#!/bin/bash
osascript - "$@" <<EOF
on run argv
tell application "iTerm"
activate
set new_term to (create window with default profile)
tell new_term
tell the current session
repeat with arg in argv
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
This provides a script which can then pass arguments passed into it, into another iterm2 terminal.
For example:
$ ./a.bash "echo 'hello iterm2'"
  Â
References
- https://stackoverflow.com/questions/32675804/how-do-i-execute-a-command-in-an-iterm-window-from-the-command-line
Thanks but how can I take the script to the argument of thea.bash
?./a.bash < my_script
does not work (it only launches the window). It works if it is./a.bash "tmux new -s dev"
, though.
â Blaszard
Jul 5 at 11:26
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
add a comment |Â
up vote
0
down vote
You can use applescript to do something like this:
$ cat a.bash
#!/bin/bash
osascript - "$@" <<EOF
on run argv
tell application "iTerm"
activate
set new_term to (create window with default profile)
tell new_term
tell the current session
repeat with arg in argv
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
This provides a script which can then pass arguments passed into it, into another iterm2 terminal.
For example:
$ ./a.bash "echo 'hello iterm2'"
  Â
References
- https://stackoverflow.com/questions/32675804/how-do-i-execute-a-command-in-an-iterm-window-from-the-command-line
Thanks but how can I take the script to the argument of thea.bash
?./a.bash < my_script
does not work (it only launches the window). It works if it is./a.bash "tmux new -s dev"
, though.
â Blaszard
Jul 5 at 11:26
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can use applescript to do something like this:
$ cat a.bash
#!/bin/bash
osascript - "$@" <<EOF
on run argv
tell application "iTerm"
activate
set new_term to (create window with default profile)
tell new_term
tell the current session
repeat with arg in argv
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
This provides a script which can then pass arguments passed into it, into another iterm2 terminal.
For example:
$ ./a.bash "echo 'hello iterm2'"
  Â
References
- https://stackoverflow.com/questions/32675804/how-do-i-execute-a-command-in-an-iterm-window-from-the-command-line
You can use applescript to do something like this:
$ cat a.bash
#!/bin/bash
osascript - "$@" <<EOF
on run argv
tell application "iTerm"
activate
set new_term to (create window with default profile)
tell new_term
tell the current session
repeat with arg in argv
write text arg
end repeat
end tell
end tell
end tell
end run
EOF
This provides a script which can then pass arguments passed into it, into another iterm2 terminal.
For example:
$ ./a.bash "echo 'hello iterm2'"
  Â
References
- https://stackoverflow.com/questions/32675804/how-do-i-execute-a-command-in-an-iterm-window-from-the-command-line
answered Jul 4 at 23:12
slmâ¦
233k65479651
233k65479651
Thanks but how can I take the script to the argument of thea.bash
?./a.bash < my_script
does not work (it only launches the window). It works if it is./a.bash "tmux new -s dev"
, though.
â Blaszard
Jul 5 at 11:26
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
add a comment |Â
Thanks but how can I take the script to the argument of thea.bash
?./a.bash < my_script
does not work (it only launches the window). It works if it is./a.bash "tmux new -s dev"
, though.
â Blaszard
Jul 5 at 11:26
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
Thanks but how can I take the script to the argument of the
a.bash
? ./a.bash < my_script
does not work (it only launches the window). It works if it is ./a.bash "tmux new -s dev"
, though.â Blaszard
Jul 5 at 11:26
Thanks but how can I take the script to the argument of the
a.bash
? ./a.bash < my_script
does not work (it only launches the window). It works if it is ./a.bash "tmux new -s dev"
, though.â Blaszard
Jul 5 at 11:26
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
@Blaszard - can you please update your question, it's not clear what exactly you want/expect to happen here then.If the last part works I'd saw your problem's solved, which I know isn't the case in your mind, but we need more to go on then.
â slmâ¦
Jul 5 at 13:55
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453499%2fhow-can-i-launch-a-new-session-of-tmux-in-iterm2-on-a-separate-window%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password