iTerm 2.9 AppleScript: exec command in split session, evenly tile panes

231 views
Skip to first unread message

Yorgos Magos

unread,
Nov 23, 2015, 11:14:23 PM11/23/15
to iterm2-discuss
Hi

1) I was  glad to see much improved AppleScript support in the beta version, including the split horizontally / vertically set of commands for sessions. However, there is something that was previously possible for a session, but now seems to be unavailable: to exec a command in a session.

Previously I could just "exec command my_command" in a newly created session; the exec command seems to have been removed completely. Interestingly, there is a nice optional parameter to the create window and create tab commands: "create tab with profile my_profile command my_command", but this does not seem to be available for the split commands.

Is there any way to do this, apart from using writing text to the session?

2) Even better, is there going to be a way to tile panes, like tmux C-B M-5? Specifically, take all tabs in a window and convert them to evenly sized panes? This would cover #1 above as well, as I could create the sessions as tabs, then tile them with a single keystroke.

Background:

The main task I have in mind is integration with the network simulator GNS3. The Mac version has a simple AppleScript built in for iTerm integration; this just grabs the current session and adds sessions as tabs, doing an "exec command telnet <host> <port>" on each, to access the consoles of all routers in the simulation. My ideal workspace would be a single tab (or multiple if I have more than, say, 6 consoles open at the same time), transparent so that I can see the topology underneath, with the sessions evenly laid out as panes. Currently I can do exactly this, invoking a profile in my custom AppleScript to get the transparency, but manually laying out the tabs as panes. And every time I reboot the simulated routers, the telnet connection dies and I have to do the process again.

Regards,
Yorgos

George Nachman

unread,
Dec 5, 2015, 1:58:02 PM12/5/15
to iterm2-...@googlegroups.com
1) That was an oversight. I've added an optional command argument to all the "split…" commands:
tell application "iTerm2"
tell current session of first window
split vertically with profile "Default" command "echo 1"
split vertically with default profile command "echo 2"
split vertically with same profile command "echo 3"
split horizontally with profile "Default" command "echo 4"
split horizontally with default profile command "echo 5"
split horizontally with same profile command "echo 6"
end tell
end tell

2) Sorry, there's nothing like that at the moment. Please file a feature request at iterm2.com/bugs.


--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages