mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
Implements #461
Include commands tabcloseAllToRight and tabcloseAllToLeft closing all tabs to the left/right of the active one. No default binding included.
This commit is contained in:
parent
59ed93b286
commit
b1365e134e
1 changed files with 30 additions and 0 deletions
|
@ -1269,6 +1269,36 @@ export async function tabclose(...indexes: string[]) {
|
|||
}
|
||||
}
|
||||
|
||||
/** Close all tabs to the right of the current one
|
||||
*
|
||||
*/
|
||||
//#background
|
||||
export async function tabcloseAllToRight() {
|
||||
const tabs = await browser.tabs.query({
|
||||
pinned: false,
|
||||
currentWindow: true,
|
||||
})
|
||||
|
||||
const atab = await activeTab()
|
||||
let ids = tabs.filter(tab => tab.index > atab.index).map(tab => tab.id)
|
||||
browser.tabs.remove(ids)
|
||||
}
|
||||
|
||||
/** Close all tabs to the left of the current one
|
||||
*
|
||||
*/
|
||||
//#background
|
||||
export async function tabcloseAllToLeft() {
|
||||
const tabs = await browser.tabs.query({
|
||||
pinned: false,
|
||||
currentWindow: true,
|
||||
})
|
||||
|
||||
const atab = await activeTab()
|
||||
let ids = tabs.filter(tab => tab.index < atab.index).map(tab => tab.id)
|
||||
browser.tabs.remove(ids)
|
||||
}
|
||||
|
||||
/** restore most recently closed tab in this window unless the most recently closed item was a window */
|
||||
//#background
|
||||
export async function undo() {
|
||||
|
|
Loading…
Add table
Reference in a new issue