Pinned tabs are not closeable by 'd'

Added binding 'DD' to force tab close which also closes pinned tabs
This commit is contained in:
Cornelius Matějka 2017-11-22 19:22:30 +01:00
parent 423d17aeb6
commit e7dcd7f500
4 changed files with 16 additions and 3 deletions

View file

@ -17,6 +17,8 @@ const exec = (operation, tab) => {
switch (operation.type) {
case operations.TAB_CLOSE:
return tabs.closeTab(tab.id);
case operations.TAB_CLOSE_FORCE:
return tabs.closeTabForce(tab.id);
case operations.TAB_REOPEN:
return tabs.reopenTab();
case operations.TAB_PREV:

View file

@ -9,6 +9,14 @@ browser.tabs.onActivated.addListener((activeInfo) => {
});
const closeTab = (id) => {
return browser.tabs.get(id).then((tab) => {
if(!tab.pinned) {
return browser.tabs.remove(id);
}
})
};
const closeTabForce = (id) => {
return browser.tabs.remove(id);
};
@ -130,7 +138,8 @@ const duplicate = (id) => {
};
export {
closeTab, reopenTab, selectAt, selectByKeyword, getCompletions,
selectPrevTab, selectNextTab, selectFirstTab, selectLastTab, selectPrevSelTab,
reload, updateTabPinned, toggleTabPinned, duplicate
closeTab, closeTabForce, reopenTab, selectAt, selectByKeyword,
getCompletions, selectPrevTab, selectNextTab, selectFirstTab,
selectLastTab, selectPrevSelTab, reload, updateTabPinned,
toggleTabPinned, duplicate
};