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 and chrome 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)) calls callback(args) with an args 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 the args object:
    enablePlugins: true
    favIcon: "<insert really long url>"
    loadFromCacheOnly: false
    showImages: true
    
    • In each #header > .tabs-container .tab-strip > span, there is a div.tab which has id=tab-integer (replace "integer" with the numerical tab id). However, in the tab representations for tab stacks, the div.tab has an additional tab-group class, and instead of the id containing an integer, it instead contains some odd string. In the case of a tab stack I created to test this out, the id was tab-cj8zbizrn000e425tomdaav3d. And because both vivaldi.tabsPrivate.get() and chrome.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.tabs or their parent spans. 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 in browser.html--at least, not without prettifying and examining bundle.js, which would be quite the undertaking. For the sake of simplicity, is there any way to retrieve tab stack data from the vivaldi 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?



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


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.