Last active
September 28, 2017 03:24
-
-
Save mavc/cbaeda11b3f510f23fa165316e12903c to your computer and use it in GitHub Desktop.
Foxy Gestures: Close Tab and Focus Left
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
executeInBackground(async () => { | |
const tabs = await browser.tabs.query({currentWindow: true}); | |
const activeTab = tabs.find((t) => t.active); | |
if (activeTab.index > 0) { | |
// Set the current tab to the tab on the left. | |
let nextTab = tabs.find((t) => t.index == activeTab.index - 1); | |
await browser.tabs.update(nextTab.id, {active: true}); | |
} | |
// Close the current tab. | |
await browser.tabs.remove(activeTab.id); | |
}).catch((e) => { | |
console.error(e); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment