Add tabclose functionality

This commit is contained in:
Oliver Blanthorn 2017-09-30 17:36:36 +01:00
parent f777e9d396
commit a7d358a288
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 12 additions and 0 deletions

View file

@ -46,6 +46,17 @@ namespace ExCmds {
browser.tabs.update(id,{active:true})
}
export function closetabs(ids: number[]){
browser.tabs.remove(ids)
}
export async function tabclose(n = 1){
let filtTabs = await browser.tabs.query({active: true})
let activeTabID = filtTabs[0].id
// TODO: work out what the ids of the next n tabs are and close them also
closetabs([activeTabID])
}
/** Switch to the next tab by index (position on tab bar), wrapping round.
optional increment is number of tabs forwards to move.

View file

@ -14,6 +14,7 @@ namespace Parsing {
["j", "scrolldownline"],
["H", "historyback"],
["L", "historyforward"],
["d", "tabclose"],
["k", "scrollupline"],
["gt", "tabnext"],
["gT", "tabprev"],