Pinned tabs are not closeable by 'd'

Added binding 'DD' to force tab close which also closes pinned tabs
jh-changes
Cornelius Matějka 7 years ago
parent 423d17aeb6
commit e7dcd7f500
  1. 2
      src/background/actions/operation.js
  2. 15
      src/background/tabs.js
  3. 1
      src/shared/operations.js
  4. 1
      src/shared/settings/default.js

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

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

@ -33,6 +33,7 @@ export default {
// Tabs // Tabs
TAB_CLOSE: 'tabs.close', TAB_CLOSE: 'tabs.close',
TAB_CLOSE_FORCE: 'tabs.close.force',
TAB_REOPEN: 'tabs.reopen', TAB_REOPEN: 'tabs.reopen',
TAB_PREV: 'tabs.prev', TAB_PREV: 'tabs.prev',
TAB_NEXT: 'tabs.next', TAB_NEXT: 'tabs.next',

@ -23,6 +23,7 @@ export default {
"G": { "type": "scroll.bottom" }, "G": { "type": "scroll.bottom" },
"$": { "type": "scroll.end" }, "$": { "type": "scroll.end" },
"d": { "type": "tabs.close" }, "d": { "type": "tabs.close" },
"DD": { "type": "tabs.close.force" },
"u": { "type": "tabs.reopen" }, "u": { "type": "tabs.reopen" },
"K": { "type": "tabs.prev", "count": 1 }, "K": { "type": "tabs.prev", "count": 1 },
"J": { "type": "tabs.next", "count": 1 }, "J": { "type": "tabs.next", "count": 1 },