-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: auto-generate layout file from currently running tmux session #32
Comments
I’ve been thinking about this for quite some times now, this is a feature I would also like to see. The way I see it, a teamocil file is made from two main things: layout and commands. LayoutI just added support for a tmux list-windows -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f 2 CommandsAs far as I’m aware, I don’t think it’s possible to extract the currently running command in each split. But I think the hardest part of building a teamocil layout is the actual splits layout. So what I suggest is you manually build your layout, run the command above to extract its layout serialized string. You’ll then have something like this: windows:
- name: my new layout
layout: "23f9,204x51,0,0{102x51,0,0,81,101x51,103,0[101x25,103,0,82,101x25,103,26{50x25,103,26,83,50x25,154,26,84}]}" After that, you just have to create your windows:
- name: my new layout
layout: "23f9,204x51,0,0{102x51,0,0,81,101x51,103,0[101x25,103,0,82,101x25,103,26{50x25,103,26,83,50x25,154,26,84}]}"
splits:
- cmd:
- echo first
- cmd:
- echo second'
- cmd:
- echo third'
- cmd:
- echo fourth' Hope that helps! |
Wow, cool! I've got to try this. Thanks for the suggestion! Now that I'm thinking about it, it should be relatively easy to get the current working directory (for the "root" option). And maybe one can inspect the shell history for the latest command? Unfortunately I don't know much ruby, otherwise I'd try to create some kind of teamocil command for that task. I'll probably try a shell script first. |
Well, history does not work. |
There are some issues with this approach. For starters, the order of panes in the layout string is apparently not the same as the order of panes as returned by the list-panes command. That's why the commands end up in the wrong pane. Not dramatic, but not nice. No idea so far how to fix this. |
Yeah, I actually thought this would be an issue, but I figured it would be much simpler to move the commands around in the YAML file than trying to parse |
Oh yes :) |
Aaaaaand there is another issue. Apparently the layout strings are not compatible across tmux versions. Too bad. |
I’m going to close this issue now since I’ve added the |
Hi @remiprev, |
@scientist1642 Yeah, I think it was in the |
@scientist1642 Done! 7f8a47f |
@remiprev cool! 🎉 |
Just like "pip freeze" - freezes the currently visible tmux layout into a layout file skeleton. Would greatly simplify layout setup...
Anyway - teamocil is a great tool, don't want to miss it :) Thanks!
The text was updated successfully, but these errors were encountered: