Skip to content

Latest commit

 

History

History
132 lines (105 loc) · 8.67 KB

README.md

File metadata and controls

132 lines (105 loc) · 8.67 KB

Disable Tabs

DisableTabs is a simple extension that excises the tabs feature from Firefox.

Firefox is a pretty good browser with modern features, a good selection of addons and excellent history search. But under tabbed or any other tiling-style window manager that makes tabs an OS service, it is irritating. Mozilla really wants you to use tabs, but luckily they also have a flexible extension API which we can use to counteract them. Installing it makes browsing tab-less like surf, without needing to abandon useful addons like uMatrix, HttpsEverywhere and NoScript.

Download

(published version coming Real Soon Now, 'soons I work out the kinks and get it through AMO security review).

You can also build and install it yourself.

Development

First install mozilla's packaging manager jpm, and make if you don't already have that. If jpm's not in your system package manager, you need to bootstrap it from npm, which you should be able to find in your package manager:

$ sudo apt-get install npm  #adapt as necessary to your OS
$ sudo npm install --global jpm

Then:

  • make test - Run the extension on Firefox (stable) with a new temporary profile, and with console.log() directed to stdout.
  • make package - Package the extension into an XPI file.
  • When packaging, be aware of the .jpmignore file: don't publish passwords or test code!
  • make signed - Package and sign the extension into an XPI file. Requires AMO credentials in api_secret.txt.
  • firefox disable_tabs-1.3.0-fx.xpi - to install
  • Firefox is picky about this: it won't accept this as a file:// URL, it won't accept it if you paste the path into the address bar, and it won't accept it if there's ../s in the path. It will accept it from http://localhost:8000/ but you need to whitelist localhost first(TODO: confirm this).
  • You can also use the GUI: Firefox > Menu > Add-ons > Extensions > Settings Dropdown > Install Add-on From File
  • If it silently fails, the signature check is probably failing. See below.

Signing

For Firefox 46+, extensions will require signing to be installed. They will be signed if uploaded to addons.mozilla.org -- once they've been manually reviewed by humans, or you can automate it if you get an API key from https://addons.mozilla.org/en-US/developers/addon/api/key/.

If you use jpm run then you do not need your extension signed. If you have Developer Firefox and set xpinstall.signatures.required = false in about:config, you do not need your extension signed. It is not clear to me if it is possible to self-sign with a manually installed CA, or if you must use Mozilla's root key. It seems that Mozilla's plan is for Firefox to fragment into user and developer editions:

  • the former requiring signatures,
  • the latter with secret toggle off but they also allow automated signing, but only for extensions which aren't on addons.mozilla.org(??) --- so you can sign and host an extension on your own server and Firefox will happily accept it??

Anyway, this all sounds very not DIY friendly, though I suppose I can't fault them since the web is a dangerous place.

To use make signed you need to get an account at AMO, generate an API key, and paste the "key" (i.e. the API account name) into package.json and the "secret" (i.e. the password) into ./api_secret.txt.

If you get

status: 401
response: {"detail":"JWT iat (issued at time) is invalid. Make sure your system clock is synchronized with something like TLSdate."}
Then your clock is skewed. You should be able to fix this with:
$ sudo ntpd -sd
adjtimex returns frequency of 2.123993ppm
constraint certificate verification turned off
ntp engine ready
reply from 206.108.0.133: offset -269.513726 delay 0.107407, next query 8s 
set local clock to Sun Feb 21 18:42:02 EST 2016 (offset -269.513726s)
reply from 167.114.204.238: negative delay -269.397765s, next query 3090s
reply from 192.95.20.208: negative delay -269.381063s, next query 3029s
reply from 199.182.221.110: negative delay -269.339643s, next query 3073s
^Cntp engine exiting   # notice the Ctrl-C here, ntpd won't exit by itself

Everytime you sign it you need to bump the version number: AMO remembers every version it signs, forever. So watch your language (i.e. don't swear in C++ or cuss in ALGOL).

References

TODO

  • [?] At boot the tab bar displays for a couple seconds because main() doesn't run fast enough. Is there anything I can do about this?
  • Sometimes the tabbar reappears --- it seems to last until the new tab's 'ready' handler fires at least.
  • On init, detach all tabs -- otherwise enabling/installing the extension during an active session can lead to lost tabs
  • The Double Download Bug
    • Because .ready doesn't fire until after it's downloaded a page, we are downloading pages twice
  • [x?] It's possible to press ctrl-t really fast and spawn lots of tabs which never get caught by the extension
  • Need a new logo
  • Check compatibility with multiprocess Firefox; our package.json claims compatibility, but we use the low level API, but we only use it a little bit
  • BUG: window.on('open') doesn't get called in some cases
  • BUG: sometimes pages go blank and don't come back -- though the tab-group pane (ctrl-shift-e) still displays their content
    • Is it as simple as an uncaught exception? One that, since it's crashing in the XUL layer, snipes the whole page?
    • It's reliably triggered by "Search for " in the context menu
  • See if it's possible to display: none the menu, context, and preference items that reference tabs as well
  • [?] Read browser.tabs.loadInBackground (aka "When I open a link in a new tab, switch to it immediately") and replicate it by window.activate()
      • then distribute documentation on how to no_focus in i3 and other tiling window managers so that only those winodws have this behaviour
    • I think I did this, but it doesn't work on my system. Maybe i3 is overriding .focus() events?
  • SDK bug: after .detach(), tabs.activeTab is set to the newly detached tab, even if it doesn't have the focus. You have to switch to another window and switch back to set it correct.
  • Is there a way to catch the extension being disabled? I would like to undo my remove_tabbar hack in that case, see.
  • If the "Firefox has prevented this redirect" warning triggers, it sticks on the first window then immediately vanishes instead of following the tab to the second, so then it just seems like disabletabs broke the link. -- I guess the warning's DOM element is attached to the window instead of the tab -- frankly, I think this is a bug in the browser, not here
  • When I was using tab.close() and duplicating the tab, the window the tab was being created in would be static, but now it briefly shows the next tab if the next tab is a new window instead of being made by rightclick->make new tab. It seems that the .on('open') handler runs before the UI updates, and has a chance to affect how the UI updates therefore.
  • a. try switching back to that + using .duplicateTab() (which is somewhere in the API) to see if the UI behaves like I think
  • b. try exploring preventDefault() and returning false and stuff
    • return false; doesn't work.
  • c. is there an earlier event I can catch? maybe it's better to just

License

MPL 2.0.

Based on @cheeaun's maxtabs and @Chris000001's hide tab bar. Thanks to @noitidart for XUL help.

Alternatives