mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
:tabclose now accepts win.tab format
This commit is contained in:
parent
239566a2aa
commit
97719fb32f
1 changed files with 8 additions and 1 deletions
|
@ -2475,8 +2475,15 @@ export async function fullscreen() {
|
||||||
//#background
|
//#background
|
||||||
export async function tabclose(...indexes: string[]) {
|
export async function tabclose(...indexes: string[]) {
|
||||||
let done
|
let done
|
||||||
|
async function maybeWinTabToTabId(id: string) {
|
||||||
|
if (id.includes(".")) {
|
||||||
|
const [winid, tabindex_number] = await parseWinTabIndex(id)
|
||||||
|
return (await browser.tabs.query({ windowId: winid, index: tabindex_number }))[0].id
|
||||||
|
}
|
||||||
|
return idFromIndex(id)
|
||||||
|
}
|
||||||
if (indexes.length > 0) {
|
if (indexes.length > 0) {
|
||||||
const ids = await Promise.all(indexes.map(index => idFromIndex(index)))
|
const ids = await Promise.all(indexes.map(index => maybeWinTabToTabId(index)))
|
||||||
done = browser.tabs.remove(ids)
|
done = browser.tabs.remove(ids)
|
||||||
} else {
|
} else {
|
||||||
// Close current tab
|
// Close current tab
|
||||||
|
|
Loading…
Add table
Reference in a new issue