Skip to content

regunakyle/firefox-auto-vertical-tab

Repository files navigation

Firefox Auto Vertical Tab Toggle

demo.mp4

This is a Firefox ONLY extension built with WXT.

Requires Firefox 142 or newer.

This extension does not collect any data nor send any data to any server.

Logic

Check the width of currently focused Firefox window every 0.1 second:

  1. If width <= user defined threshold, enable vertical tab
  2. If width > user defined threshold, disable vertical tab

The user defined threshold is 1080 (in pixels) by default.

You may also choose to reverse this behavior, so that vertical tabs are enabled when the window width is above the threshold (and vice versa).

You can edit these settings in the extension's menu.

Why use an interval instead of the window.onresize event listener?

The window.onresize event listener is indeed the most obvious solution to the problem.

However, I can only use it within content scripts, which do not work in privileged domains (e.g. about:config, Mozilla domains).

In addition, requiring a content script means the extension would need access to all domains. This might discourage some users from installing it.

Weighing these points, I decided to use an interval in a background script instead. Checking 10 times per second is not much of a burden for modern PCs anyway.

In fact, there is a windows.onBoundsChanged event listener (MDN) that can work in background script. The problem is that Firefox hasn't implement it (lol).

Please leave a comment in this Bugzilla to nudge them to implement it. In the meantime, please also upvote this per-window vertical tab setting feature request.

Build

Environment

  • Fedora 42 KDE
  • Firefox Developer Edition (142.0b5)
  • Node.js 22.17.1

Instructions

npm install
npm run zip

TODO

  • Write Playwright tests

Attribution

The app icon (created by Smashicons) is downloaded from flaticon.com for free.

About

Firefox extension that automatically toggle vertical tab mode

Resources

License

Stars

Watchers

Forks