mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Fix #404: add winmerge command
This commit is contained in:
parent
ff88686739
commit
d36246a6a4
2 changed files with 19 additions and 1 deletions
|
@ -32,7 +32,11 @@ export class WindowCompletionSource extends Completions.CompletionSourceFuse {
|
||||||
public options: WindowCompletionOption[]
|
public options: WindowCompletionOption[]
|
||||||
|
|
||||||
constructor(private _parent) {
|
constructor(private _parent) {
|
||||||
super(["tabpush", "winclose"], "WindowCompletionSource", "Windows")
|
super(
|
||||||
|
["tabpush", "winclose", "winmerge"],
|
||||||
|
"WindowCompletionSource",
|
||||||
|
"Windows",
|
||||||
|
)
|
||||||
|
|
||||||
this.updateOptions()
|
this.updateOptions()
|
||||||
this._parent.appendChild(this.node)
|
this._parent.appendChild(this.node)
|
||||||
|
|
|
@ -2091,6 +2091,20 @@ export async function tabpush(windowId: number) {
|
||||||
return activeTabId().then(tabId => browser.tabs.move(tabId, { index: -1, windowId }))
|
return activeTabId().then(tabId => browser.tabs.move(tabId, { index: -1, windowId }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves all of the targetted window's tabs to the current window. Only works for windows of the same type
|
||||||
|
* (can't merge a non-private tab with a private window).
|
||||||
|
*/
|
||||||
|
//#background
|
||||||
|
export async function winmerge(windowId: number) {
|
||||||
|
const target_win = await browser.windows.get(windowId, { populate: true })
|
||||||
|
const active_win = await browser.windows.getCurrent()
|
||||||
|
return browser.tabs.move(
|
||||||
|
target_win.tabs.map(t => t.id),
|
||||||
|
{ index: -1, windowId: active_win.id },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a string of the format windowIndex.tabIndex, returns a tuple of
|
* Given a string of the format windowIndex.tabIndex, returns a tuple of
|
||||||
* numbers corresponding to the window index and tab index or the current
|
* numbers corresponding to the window index and tab index or the current
|
||||||
|
|
Loading…
Add table
Reference in a new issue