aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuan Nico <luanpotter27@gmail.com>2018-02-22 20:14:03 -0300
committerLuan Nico <luanpotter27@gmail.com>2018-02-22 20:14:03 -0300
commit43079f2c68a3f04b83eed10ee13b7dddab524d24 (patch)
treea402911dcf4fa2f52467fafbed74cdd305551292 /src
parentd0e4fc92ce678fdb18fc27a9810f7fb1c8b8a8f5 (diff)
implement :q to close tab
Diffstat (limited to 'src')
-rw-r--r--src/background/actions/command.js9
1 files changed, 9 insertions, 0 deletions
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();
}