Since users of treestyletab are uses who have a lot of tabs open, it would be useful to display the tabnumber, from 1.. upwards.
Use cases:
....
Being a long-time vimperator user in the past, before FX57, this is something I miss, and that I think TST could possibly provide :).
This is especially useful for the handful of "pinned tabs" which can be accessed with shortcuts alt + 1 (2, .., 8) (cmd for Mac).
Exactly! Users of for example vimium-ff (like me) can also go to tab by numbers: <tabnum>gt.
It seems possible via user-defined style rules like:
#tabbar {
counter-reset: tabs;
}
.tab:not(.collapsed) {
counter-increment: tabs;
}
.tab .active-marker::before {
background: Highlight;
color: HighlightText;
content: counter(tabs);
font-size: x-small;
right: 0.2em;
padding: 0.2em;
pointer-events none;
position: absolute;
bottom: 0.2em;
}
@piroor cool!
Could we get this as a real option in TST, or at least added to the wiki? =)
https://github.com/piroor/treestyletab/wiki/Code-snippets-for-custom-style-rules
The suggested CSS code doesn't seem to update correctly when a tab is closed. The tab counter will still count any tab that is closed after you start using it. This can easily be seen by closing a tab and then looking at the neighbors of that tab. This bug can also be seen by repeatedly opening a new tab and closing it.
@Lej77 it is another bug and fixed by 5d227419eb847ca9b67f380334ce008d3f4b05e9.
@erikw OK, I've added this to the code snippets as https://github.com/piroor/treestyletab/wiki/Code-snippets-for-custom-style-rules#numbering-of-tabs-1601
sorrry to spam this, but how can I know to which version that code corresponds to ? I would like to have the tab numbers, but only when the fixed version is available 馃槂
@cipri-tom did you want to know the version of TST including https://github.com/piroor/treestyletab/issues/1601#issuecomment-346267144 ? Then it is not released yet as a public version. Only development version is available: https://piro.sakura.ne.jp/xul/xpi/nightly/treestyletab-we.xpi
Is is possible to add a Ctrl+<123> shortcut for a multidigit number typed within say a one second time interval?
Tab numbers could also show up only on pressing and holding the modifier key.
For vi-like extensions, I would be especially interested in relative tab numbers from the currently active one, as proximity to the active tab is usually higher for tabs I'm interested in. With just the CSS, I can browse any tab currently using <n>g0, but having ~500 tabs open means I always need to remember and press 3 digits when browsing around in the lower ends instead of 1-2 for the common case. Think of relative line numbers in vim.
Here is a modified version of https://github.com/piroor/treestyletab/wiki/Code-snippets-for-custom-style-rules#tab-numbering-and-counting showing numbers only the active tab and its followers:
#tabbar,
tab-item.active {
counter-reset: vtabs atabs tabs;
/* vtabs tracks visible tabs, atabs tracks active tabs, tabs tracks all tabs */
}
tab-item:not(.collapsed):not(.discarded) {
counter-increment: vtabs atabs tabs;
}
tab-item:not(.collapsed) {
counter-increment: vtabs tabs;
}
tab-item:not(.discarded) {
counter-increment: atabs tabs;
}
tab-item {
counter-increment: tabs;
}
tab-item .extra-items-container.behind {
z-index: unset !important;
}
tab-item.active .extra-items-container.behind::after,
tab-item.active ~ tab-item .extra-items-container.behind::after {
background: Highlight;
color: HighlightText;
content: counter(vtabs);
font-size: x-small;
right: 0.2em;
padding: 0.2em;
pointer-events: none;
position: absolute;
bottom: 0.2em;
z-index: 1000;
}
But it doesn't allow you to move back to the parent tab, hmm...
Most helpful comment
It seems possible via user-defined style rules like: