detach/attach tabs
wmertens opened this issue · comments
Wout Mertens commented
I don't have time right now to make a PR for the tabs plugin, but I wrote a quick extension to detach a tab and also to attach all tabs from a window.
The attaching doesn't always work but the detach seems ok.
This is the relevant code:
detach:
chrome.tabs.getSelected(null, t => {
if (t.id >= 0)
chrome.windows.create({tabId: t.id, focused: true})
})}
attach, not so great code, with deprecated calls:
chrome.windows.getLastFocused(null, ({id}) =>
chrome.tabs.getAllInWindow(id, newTabs =>
chrome.windows.getCurrent(({id:windowId}) =>
chrome.tabs.getAllInWindow(windowId, currentTabs => {
let i = currentTabs.length
newTabs.forEach(({id: tabId}) =>
chrome.tabs.move(tabId, {windowId, index: i++}, console.log)
)
})
)
)
)
tomasy commented
tomasy commented
The plugin has been developed and uploaded to the repository. You can install it using spm install windowtabs
. The det
/ att
commands correspond to detach and attach respectively.