▲ 5 r/zen_browser
How to set a keyboard shortcut for "Unload Tab" in Zen Browser (macOS)
Hey everyone, I wanted to share a way to assign a keyboard shortcut to "Unload Tab" in Zen Browser on macOS, since there's no native option for this in the keyboard shortcuts settings.
What you need:
fx-autoconfig: https://github.com/MrOtherGuy/fx-autoconfig
Installation:
- Download fx-autoconfig and copy
config.jsanddefaults/from theprogram/folder to/Applications/Zen.app/Contents/Resources/ - Copy the contents of the
profile/folder to your Zen profile'schrome/folder (find it viaabout:profiles→ Open Folder) - Create a file
chrome/JS/unload-tab.uc.jswith this script:
​
let tabHistory = [];
gBrowser.tabContainer.addEventListener("TabSelect", (e) => {
tabHistory = tabHistory.filter(t => t !== e.target);
tabHistory.push(e.target);
if (tabHistory.length > 20) tabHistory.shift();
}, true);
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key.toLowerCase() === "u") {
let tab = gBrowser.selectedTab;
let prevTab = [...tabHistory].reverse().find(t => t !== tab && !t.closing && !t.hasAttribute("pending"));
if (prevTab) {
gBrowser.selectedTab = prevTab;
}
gBrowser.discardBrowser(tab);
}
}, true);
Then restart Zen Browser
The shortcut is Ctrl+U, change it in the script to whatever you prefer. It unloads the current tab and switches to the last active non-unloaded tab.
Hope this helps!
u/x_ATOM_d — 1 day ago