diff options
| author | Cornelius Matějka <matejka.cornelius@mailbox.org> | 2017-11-22 19:22:30 +0100 | 
|---|---|---|
| committer | Cornelius Matějka <matejka.cornelius@mailbox.org> | 2018-01-14 17:19:02 +0100 | 
| commit | e7dcd7f500f9c139835313a573f861a10aa49d18 (patch) | |
| tree | 9427f23f21a2d917ea7a160db2eae5ed74f57d38 /src | |
| parent | 423d17aeb6117fad7fbd1d18021e39d444a65b51 (diff) | |
Pinned tabs are not closeable by 'd'
Added binding 'DD' to force tab close which also closes pinned tabs
Diffstat (limited to 'src')
| -rw-r--r-- | src/background/actions/operation.js | 2 | ||||
| -rw-r--r-- | src/background/tabs.js | 15 | ||||
| -rw-r--r-- | src/shared/operations.js | 1 | ||||
| -rw-r--r-- | src/shared/settings/default.js | 1 | 
4 files changed, 16 insertions, 3 deletions
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js index cfee868..1188ea2 100644 --- a/src/background/actions/operation.js +++ b/src/background/actions/operation.js @@ -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: diff --git a/src/background/tabs.js b/src/background/tabs.js index d50d8e5..e02932a 100644 --- a/src/background/tabs.js +++ b/src/background/tabs.js @@ -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  }; diff --git a/src/shared/operations.js b/src/shared/operations.js index 19466df..4172f8b 100644 --- a/src/shared/operations.js +++ b/src/shared/operations.js @@ -33,6 +33,7 @@ export default {    // Tabs    TAB_CLOSE: 'tabs.close', +  TAB_CLOSE_FORCE: 'tabs.close.force',    TAB_REOPEN: 'tabs.reopen',    TAB_PREV: 'tabs.prev',    TAB_NEXT: 'tabs.next', diff --git a/src/shared/settings/default.js b/src/shared/settings/default.js index e81df2b..826e3f6 100644 --- a/src/shared/settings/default.js +++ b/src/shared/settings/default.js @@ -23,6 +23,7 @@ export default {      "G": { "type": "scroll.bottom" },      "$": { "type": "scroll.end" },      "d": { "type": "tabs.close" }, +    "DD": { "type": "tabs.close.force" },      "u": { "type": "tabs.reopen" },      "K": { "type": "tabs.prev", "count": 1 },      "J": { "type": "tabs.next", "count": 1 },  | 
