sourcegraph/thyme

Should track individual iTerm tabs

evidanary opened this issue · 3 comments

I spend a good amount of time on one of the various tabls I have open in iTerm2. Currently, there is only one record for iTerm in the json file.

{
"ID": 88,
"Name": "1. tmux new-session -s test (tmux) - iTerm2"
}

It'll be great if records were broken down further by iTerm tabs

Do you have some idea of how to differentiate the tabs? AFAIK the tabs usually do not have meaningful names in contrast to for example browser tabs.

@HalfVoxel I have a Tmux session open in every iTerm2 tab. I name my Tmux sessions e.g. server, client, production, ... you get the point.

The active tab name shows up in the Thyme json file as follows:
"Name": "1. tmux new-session -s production (tmux) - iTerm2"

That'll be enough to tell them apart.

It looks like iTerm2 is Applescriptable: https://www.iterm2.com/documentation-scripting.html.

image

I'll have limited time over the next week to look into this, unfortunately, but if someone wants to look at the Applescript in the macOS implementation, I imagine it wouldn't be too hard to extend with a special case for iTerm2: https://github.com/sourcegraph/thyme/blob/master/darwin.go#L37 (pro-tip: install the Sourcegraph Chrome extension to get jump-to-def so it's easier to browse the code: https://chrome.google.com/webstore/detail/sourcegraph-for-github/dgjhfomjieaadpoljlnidmbgkdffpack?hl=en)