mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Add tabclosepinned option to config tabclose on pinned tabs
This commit is contained in:
parent
cc9db0cd07
commit
53dfaa6ecb
2 changed files with 18 additions and 5 deletions
|
@ -2519,14 +2519,22 @@ export async function tabclose(...indexes: string[]) {
|
|||
}
|
||||
return idFromIndex(id)
|
||||
}
|
||||
let ids
|
||||
if (indexes.length > 0) {
|
||||
const ids = await Promise.all(indexes.map(index => maybeWinTabToTabId(index)))
|
||||
done = browser.tabs.remove(ids)
|
||||
// Request to close multiple tabs
|
||||
ids = await Promise.all(indexes.map(index => maybeWinTabToTabId(index)))
|
||||
} else {
|
||||
// Close current tab
|
||||
done = browser.tabs.remove(await activeTabId())
|
||||
// Request to close the current tab
|
||||
ids = [await activeTabId()]
|
||||
}
|
||||
return done
|
||||
const tabclosepinned = (await config.getAsync("tabclosepinned") === "true")
|
||||
for (let tab_id of ids) {
|
||||
const tab = (await browser.tabs.query({index: tab_id}))[0]
|
||||
if (tab.pinned && !tabclosepinned) {
|
||||
throw new Error(`Tab $tab_id is pinned and tabclosepinned is false, aborting tabclose`)
|
||||
}
|
||||
}
|
||||
return browser.tabs.remove(ids)
|
||||
}
|
||||
|
||||
/** Close all tabs to the side specified
|
||||
|
|
|
@ -766,6 +766,11 @@ export class default_config {
|
|||
*/
|
||||
tabopenpos: "next" | "last" | "related" = "next"
|
||||
|
||||
/**
|
||||
* When enabled (the default), running tabclose will close the tabs whether they are pinned or not. When disabled, tabclose will fail with an error if a tab is pinned.
|
||||
*/
|
||||
tabclosepinned: "true" | "false" = "true"
|
||||
|
||||
/**
|
||||
* Controls which tab order to use when opening the tab/buffer list. Either mru = sort by most recent tab or default = by tab index
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue