Treestyletab: I want to use SurfingKeys to interact with Tree Style Tabs

Created on 14 Dec 2019  路  12Comments  路  Source: piroor/treestyletab

I use brookhong/Surfingkeys for keyboard driven operation as much as possible and I want to customize it to operate some parts of Tree Style Tabs.

Is there some documentation and examples on how to call TST functions from another addon?

workaround exists

All 12 comments

https://github.com/piroor/treestyletab/wiki/API-for-other-addons

I have seen that page and it looks complicated to me as I am not familiar with addon programming.

The first part speaks of the registering the addon with TST but as it is not an addon I have written myself or ready to adapt that isn't what I have in mind.

I want to know it is possible to call TST functions directly from the keyboard handing code in Surfing Keys. eg the author of Surking Keys help me with this issue where I call the desired functionality directly from the keystroke definition.

Will it possible to cal TST functionality directly in that manner?

The issue that you reference looks to me like it maps a keybind to some JavaScript code. I don't see how that would work in this situation. I believe there would need to be a tighter integration to make this happen, like the addon API in the wiki ... which, yes is more complicated.

I guess I will let @piroor comment more on this.

You don't need to register an addon. Registration is required only when the addon needs to receive events happening on TST's sidebar. Otherwise you just need to send API messages to TST via browser.runtime.sendMessage(). For example:

mapkey('<Ctrl-y>', 'Outdent current tab', () => {
    browser.runtime.sendMessage('[email protected]', {
      type: 'outdent',
      tab: 'current',
      followChildren: true
    });
});

Is there a list of all the TST API functions or messages?

I've created the index: https://github.com/piroor/treestyletab/wiki/API-for-other-addons#appendix-index-of-message-types

Which file handles the keyboard shortcuts?

I would like to see how it works and see if I can use the same commands from my SurfingKeys customisations.

I've created the index: https://github.com/piroor/treestyletab/wiki/API-for-other-addons#appendix-index-of-message-types

Hi, I have managed to find out where the commands are defined in manifest.json.

What I need to know now is how the keyboard shortcuts are assigned to the commands at runtime when the user customises them in the Keyboard Shortcuts page.

Do you use your own code for that or is the same code used by Firefox's own Manage Extensions Shortcut page.

I have learned enough to get going so I'm closing this issue. Thx to @piroor

@vonHabsi have you got any success with it? i've started with it, and managed to show hints on the tabs, but didn't found a nice way* how to capture the keyboard input for entering tab number (so at the moment the extension is only showing/hiding tab numbers when you hit the hotkey): https://github.com/actionless/firefox_tst_tabnavigation

[*] The only way i found is injecting extension JS on each opened web page, and communicate between background.js and injected js code

@piroor I'm trying to achieve something similar. I want to bind a key to collapse ALL tabs of the tree (recursively.)

There doesn't seem to be an alias for "all" tabs. Also, do you know why I'm not able to see any console log / info lines in the Browser Console (Ctrl + Shift + J) or in the Devtools Box of the extension.

mapkey('<Ctrl-y>', 'Collapse the entire tree', () => {

    // Neither does this!
    console.log("Now trying to collapse");

    let tabs = browser.runtime.sendMessage(TST_ID, {
      type:   'get-tree',
      window: 1
    });

    // This doesn't work!
    console.info(tabs);

    // Need to iterate on all tabs?
    browser.runtime.sendMessage(TST_ID, {
        type: 'toggle-tree-collapsed',
        tab:  'all',
        recursively: true
    });
});

@dufferzafar Sorry I'm not familiar to SurfingKeys...

Was this page helpful?
0 / 5 - 0 ratings