From 43079f2c68a3f04b83eed10ee13b7dddab524d24 Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Thu, 22 Feb 2018 20:14:03 -0300 Subject: implement :q to close tab --- src/background/actions/command.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/background') diff --git a/src/background/actions/command.js b/src/background/actions/command.js index 4c52bca..75d04bf 100644 --- a/src/background/actions/command.js +++ b/src/background/actions/command.js @@ -17,6 +17,12 @@ const tabopenCommand = (url) => { return browser.tabs.create({ url: url }); }; +const tabcloseCommand = () => { + return browser.tabs.query({ active: true }).then((tabList) => { + return browser.tabs.remove(tabList.map(tab => tab.id)); + }); +}; + const winopenCommand = (url) => { return browser.windows.create({ url }); }; @@ -70,6 +76,9 @@ const exec = (line, settings) => { return bufferCommand(args); case 'set': return setCommand(args); + case 'q': + case 'quit': + return tabcloseCommand(); case '': return Promise.resolve(); } -- cgit v1.2.3