microsoft / microsoft/terminal
A way to get the currently selected tab index
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Description of the new feature
The action `focus-tab` with `--target` takes a tab index to switch to.
But since one does not know which tab is selected or how many are present, this is only useful when one is creating ALL the tabs in a window manually.
If one knows the current tab index OR have a way to specify this instead of an index to `--target` the feature would be more useful.
For example, one could spawn a tab with a long running command in the background.
Currently i have resorted to using ReadProcessMemory on a running WindowsTerminal to get at the index, not exactly ideal ;)
### Proposed technical implementation details
Either `--target prev` for selecting previously selected tab, or an action for `wt` which only prints the current tab index `wt selected-tab`.
Background spawn examples:
`wt -w last new-tab "long-running-command" \; focus-tab -t prev`
OR
`wt -w last new-tab "long-running-command" \; focus-tab -t $(wt selected-tab)`
Contributor guide
Research direction
Start with the existing focus-tab action and its --target handling, then review how wt actions expose tab state and process command sequences. Decide whether the supported behavior is a prev target, a selected-tab action, or both; done means background spawn examples can identify or return to the intended tab reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100