Skip to content
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 Request] Show tabnumbers #1601

Closed
erikw opened this issue Nov 21, 2017 · 13 comments
Closed

[Feature Request] Show tabnumbers #1601

erikw opened this issue Nov 21, 2017 · 13 comments

Comments

@erikw
Copy link

erikw commented Nov 21, 2017

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:

  • "Click tab number 34 over there" to a friend
  • Finding things, remember to go back to tab 12 in a while'

....

Being a long-time vimperator user in the past, before FX57, this is something I miss, and that I think TST could possibly provide :).

@cipri-tom
Copy link

This is especially useful for the handful of "pinned tabs" which can be accessed with shortcuts alt + 1 (2, .., 8) (cmd for Mac).

@erikw
Copy link
Author

erikw commented Nov 21, 2017

Exactly! Users of for example vimium-ff (like me) can also go to tab by numbers: <tabnum>gt.

@piroor
Copy link
Owner

piroor commented Nov 21, 2017

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;
}

@erikw
Copy link
Author

erikw commented Nov 21, 2017

@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

@Lej77
Copy link
Contributor

Lej77 commented Nov 22, 2017

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.

@piroor
Copy link
Owner

piroor commented Nov 22, 2017

@Lej77 it is another bug and fixed by 5d22741.

@piroor
Copy link
Owner

piroor commented Nov 22, 2017

@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

@erikw erikw closed this as completed Nov 23, 2017
@cipri-tom
Copy link

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 😃

@piroor
Copy link
Owner

piroor commented Nov 29, 2017

@cipri-tom did you want to know the version of TST including #1601 (comment) ? 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

@vstepaniuk
Copy link

Is is possible to add a Ctrl+<123> shortcut for a multidigit number typed within say a one second time interval?

@vstepaniuk
Copy link

Tab numbers could also show up only on pressing and holding the modifier key.

@FichteFoll
Copy link

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.

@piroor
Copy link
Owner

piroor commented Aug 10, 2020

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants