6 ms·
Happy to see a scripting API but struggling to think what I'd use it for. What are some things y'all are thinking of doing with it?
by kbd 7y ago
Happy to see a scripting API but struggling to think what I'd use it for. What are some things y'all are thinking of doing with it?
- tedmiston 7y agoI've been really wanting to auto store declarative pane layouts and default run commands for each project in a file and be able to recreate them programmatically to open / close a "project", like the Projects feature in Sublime. For example, re-create a layout of multiple tabs with specific split panes for each project. Previous attempts before this API were a struggle: - You could almost do this with Saved Window Arrangements but not quite and there was no association to a project. - You could also hack something with profiles if you're willing to make a profile for each project, but it still doesn't get you there. - Bury Session is the closest which pretty much does what I want but it keeps all of the tabs running in the background. This can be a lot when you have 5-10+ tabs open each across multiple projects. No way to "sleep" a buried session that I could find. - I also tried implementing it via the previous AppleScript API and it turned out to be a lot harder than expected to open "2 tabs with 3x2 split panes each and run commands x, y, z, ... in them". Then I called the AppleScripts via Python so I could template them more easily. I got about halfway there.
- kbd 7y agoNice, good idea. I've tried similar things (saved layouts for a project) using Tmuxinator[1], but since I don't normally use Tmux it didn't stick. [1] https://github.com/tmuxinator/tmuxinator https://github.com/tmuxinator/tmuxinator
- aersoy 7y agoI used to use itermocil[1] for this. [1] https://github.com/TomAnthony/itermocil https://github.com/TomAnthony/itermocil
- daveFNbuck 7y agoI have a docker instance that I need to always be running. Whenever I start iTerm, I open an extra tab, start the docker, and bury the tab so it's just running in the background. I'm going to automate that first. This is something I've been waiting to be able to automate. I also have some helpful triggers, which I currently have a wiki page explaining how others at my company can set up. It looks like I could replace those instructions with a single command using one of these scripts. Those are the two things I've been wanting to automate for a while. After doing them, I imagine there will be plenty of things I never thought of before but will now that they're possible.
- tedmiston 7y agoDoes `docker run --detach ...` work for your use case? I have a tangentially related Docker use case: I'd like Docker Desktop (and Kubernetes) to spin down automatically in the background anytime I haven't run a container for some period of time and am on battery. It drains so much power even when idle.
- daveFNbuck 7y agoSounds like it would. I'll give that a try, thanks!