Tab Stack Data in the "vivaldi" Object
-
I'm looking into doing some modding related to tab stacks, and was curious as to where data related to tab stacks (rather than just tabs) is stored. I poked around a bit in debug mode, and found a few hints, but I'm not sure how to move forward. Here are the results of my exploration:
- The
vivaldi
andchrome
objects each have their own unique sets of data for each tab id, which seems to be numerical. chrome.tabs.get(Number id, function callback(Object args))
callscallback(args)
with anargs
object with the following fields (I'm using The Guardian's homepage as a sample tab, and it has an id of 551):
active: false audible: false autoDiscardable: true discarded: false extData: "{"read":true,"ext_id":"cj8zbix4i000d425trcw5ecqe","urlForThumbnail":"https://www.theguardian.com/us","thumbnail":"<insert really long url>"}" favIconUrl: "https://assets.guim.co.uk/images/favicons/79d7ab5a729562cebca9c6a13c324f0e/32x32.ico" height: 947 highlighted: false id: 551 incognito: false index: 2 mutedInfo: {muted: false} pinned: false selected: false status: "complete" title: "News, sport and opinion from the Guardian's US edition | The Guardian" url: "https://www.theguardian.com/us" width: 1265 windowId: 545
vivaldi.tabsPrivate.get(Number id, function callback(Object args))
offers different information in theargs
object:
enablePlugins: true favIcon: "<insert really long url>" loadFromCacheOnly: false showImages: true
- In each
#header > .tabs-container .tab-strip > span
, there is adiv.tab
which hasid=tab-integer
(replace "integer" with the numerical tab id). However, in the tab representations for tab stacks, thediv.tab
has an additionaltab-group
class, and instead of theid
containing an integer, it instead contains some odd string. In the case of a tab stack I created to test this out, theid
wastab-cj8zbizrn000e425tomdaav3d
. And because bothvivaldi.tabsPrivate.get()
andchrome.tabs.get()
only allow numerical ids, no information can be retrieved about tab stacks using those two functions. - Tabs in tab stacks still have unique ids, but they aren't listed anywhere in the aforementioned
div.tab
s or their parentspan
s. Information about those tabs can be accessed using those ids, but nowhere in the information about those tabs is it suggested that those tabs are in a tab stack.
The result of these findings is that there doesn't seem to be a way to get data about tab stacks from the
vivaldi
object inbrowser.html
--at least, not without prettifying and examiningbundle.js
, which would be quite the undertaking. For the sake of simplicity, is there any way to retrieve tab stack data from thevivaldi
object using the alphanumeric ids that I found, or to otherwise identify which tabs are tab stacks, and which tabs of numeric id are within them? - The
-
No idea, I think you would need the help of an actual developer, and they are preoccupied with more important things.
-
@jmindel I honestly think at this point it would be easier to simply write your own tab management extension with the chrome api, as I think someone else did on the forum with tree-style tabs (they rewrote it to work how they wanted and showed it in a panel). That will be far easier than trying to decipher what the tabs are doing purely based off of the DOM thats created or digging into compiled javascript.
-
@lonm Agreed. Are you referring to TabsOutliner? If so, does it already have support for tab stacks, or did someone create something similar or mod it to support them? I was curious about the data because I was hoping to create a more Vivaldi-centric (rather than Chrome-centric) tree-style tabs script, which would run, like TabsOutliner does so nicely, in a panel, as you said. If I were to try to home-bake this, I suppose I could also keep a local version of the data and store that as a tree (though it's not good practice to have duplicate data like that) and use events to regularly update it. That would only be possible, however, if Vivaldi has its own tab-related events with data related to stacks--which I have yet to investigate.
-
-
I just wrote a tab stack mod, and use the following data (in addition to the usual chrome API):
- "TAB_STACKING_NAME_MAP" in chrome.storage.local for the stack names (it's an object with tab stack IDs as properties and their names as values)
- "group" in tab.extData (a JSON string) for the tab stack (precisely: the stack's ID) a tab belongs to
- Also, tab order in a stack is determined by the tab's indices (just sort them by it)
This should be enough info to display and manipulate tab stacks.
-
@njol Why don't you share your mod?
-
@luetage I want to make sure it actually works before releasing it - I don't want others to lose all tabs or tab stacks because of it. And I just finished it this weekend, so I haven't done much testing so far - I haven't even imported my tab groups from Firefox yet.
There's also several small issues I still want to fix, e.g. the tabs' titles are sometimes the same colour as their background depending on the chosen theme.
-
Hi,
I just released Otto Tabs, a small chromium based extension to automatically group/stack your tabs when using same domain and delete duplicates. Nothing fancy, you can check it out
I used the
tab.extData
trick @Njol talked about to make it work with Vivaldi.https://github.com/Benlenem/chrome-otto-tabs
Your feedback is welcome !
-
@benlenem I love your extension
-
Wonderful! I was looking for exactly that!
-
@Njol Thanks for the info! BTW "TAB_STACKING_NAME_MAP" is not exists in the list now (Vivaldi 2.3.1440.41).
chrome.storage.local.get(function(args) { console.log(args) })
Do you know that now how can I query the data based on the tab stack ID?
-
@Daemonicvs I'm going to throw out a totally random guess and say it has something to do with chrome implementing their own sort of tab grouping feature.
-
@benlenem said in Tab Stack Data in the "vivaldi" Object:
Hi,
I just released Otto Tabs, a small chromium based extension to automatically group/stack your tabs when using same domain and delete duplicates. Nothing fancy, you can check it out
I used the
tab.extData
trick @Njol talked about to make it work with Vivaldi.https://github.com/Benlenem/chrome-otto-tabs
Your feedback is welcome !
Hello, after being removed few months ago, I published the extension again here : https://chrome.google.com/webstore/detail/otto-tabs/pjgajilkdijnbfmglfbpnenocpajmdlb
Have fun
-
@benlenem
Hello, I just found your extension, and it does exactly what I want. Thanks for your work! I also like that the automatic stack works only within the same window.Just a question. Is there a way to focus directly to the tab after it is moved? I think that looking for the correct stack after opening a link is a bit counterintuitive.
Cheers! -
@benlenem I believe that Otto tabs is one of my favorite Vivaldi extensions. I really appreciate your work!
Just in case, it looks like
tab.extData
was renamed totab.vivExtData
recently, breaking Otto tabs grouping functionality. I made a PR to address that - please find it in the repo: https://github.com/borsini/chrome-otto-tabs/pull/11 -
Following this SO post, I can confirm that
vivExtData
has been removed in latest versions.Unfortunately the
chrome.tabs.group
function does nothing on Vivaldi Thus no more support for tab grouping with Otto Tabs. -
With the patched (forked) versiΓ³n of @grigorye :
https://forum.vivaldi.net/topic/56025/auto-group-tab-stacks-by-domain/41?_=1714408532749
Otto tabs works, but has a problem in Vivaldi forum (it appears that the tabs are separated from the tab stacks and then inserted, and I think the explanation is that the URL changes as you scroll) and there's a serious compatibility issue with Workspaces.
Could you do a versiΓ³n only for Vivaldi?
-
Just out of curiosity, what would be your explanation why @benlenem says that "Unfortunately the chrome.tabs.group function does nothing on Vivaldi Thus no more support for tab grouping with Otto Tabs", but your patched version does group tabs in stacked tabs in Vivaldi?
@benlenem changed the target:
"Compatibility
Otto Tabs works with all chromium based browsers that implement the chrome.tabs api.
Tested on Chrome 124.0.6367.119, Opera 109.0.5097.68, Brave 1.65.126"
-
@barbudo2005 I have no clue, the only guess that I can make is that chrome.tabs.group was never used on Vivaldi - there was Vivaldi-specific implementation in place, that was dropped from upstream due to no way to tell Vivaldi apart from Chrome (the thing that was broken in 6.7). Hence the (Vivaldi-only) fork still works, but upstream doesn't (if I get you correctly).