TabFS: Mount your Browser Tabs as a Filesystem

Last modified on January 01, 2021

TabFS is a browser extension that
mounts your browser tabs as a filesystem to your laptop.

Out of the sector, it helps Chrome and (to a lesser extent)
Firefox, on macOS and Linux.

Every of your open tabs is mapped to a folder.

I comprise Three tabs open, and
they process to a pair of folders in TabFS

The recordsdata within a tab's folder straight replicate (and might maybe properly properly assist a watch on) the
mutter of that tab to your browser. (TODO: replace as I add further)

Example: the url.txt, textual content.txt, and title.txt
recordsdata within a tab's folder, which characterize me these keep properties
for that tab

This provides you a ton of vitality, on story of now you will be prepared to notice the overall
existing tools

to your laptop that already know the map you will be able to sort out recordsdata -- terminal
directions, scripting languages, and many others -- and use them to assist a watch on and
talk about together with your browser.

Now you determine not must code up a browser extension from
time you need to attain the leisure. It's important to perchance properly properly presumably write a script that talks to
your browser in, fancy, a melange of Python and bash, and it may actually perchance properly properly put you
it as a single customary
that you just simply
can velocity at any time when, and it's no different from scripting one other part
of your laptop.

desk of contents

Examples of stuff you will be prepared to realize!

(assuming your most fashionable listing is the fs subdirectory of the git
repo and you'll comprise the extension working)

List the titles of the general tabs you'll comprise open

$ cat mnt/tabs/by-identity/*/title.txt
TabFS/set at grasp · osnr/TabFS
Alternative Extension Distribution Recommendations - Google Chrome
Web Store Web internet web page internet hosting and Updating - Google Chrome
Dwelling / Twitter

Cull tabs fancy one other recordsdata

Selecting and deleting a bunch of tabs in my file supervisor

I'm the usage of Dired in Emacs right here, nonetheless you'll use no matter instruments you
already really feel overjoyed managing your recordsdata with.

Shut all Stack Overflow tabs

$ rm mnt/tabs/by-title/*Stack_Overflow

or (older / further specific)

$ echo seize away | tee -a mnt/tabs/by-title/*Stack_Overflow*/assist a watch on


(this course of, placing off all tabs whose titles comprise some string, is a
little contrived, nonetheless it's not that unrealistic, correct?)

(now... how would you attain this with out TabFS? I in fact have not received any
thought, off the tip of my head. fancy, how attain you even get the titles of
tabs? how attain you characterize the browser to close them?)

(I regarded up the APIs, and, OK, whereas you'll very successfully be already in a browser
extension, in a 'background script' in some unspecified time in the way forward for the extension, and your
extension has the tabs permission -- this already requires you to
assemble 2 separate recordsdata and hop between your browser and your textual content
editor to position all of it up! -- you will be prepared to realize
chrome.tabs.inquire({}, tabs=> chrome.tabs.seize away(tabs.filter(tab=>
tab.title.entails('Stack Overflow')).process(tab=>

(not horrible, nonetheless understand in any respect that upfront overhead to get it put
up. and it's not all that discoverable. and what in characterize so that you can reuse
this later, or trot it into some elevated pipeline of instruments to your
laptop, or give it a visible interface? the bounce in complexity as quickly as
it's well-known to command with the leisure -- presumably ambiance up a
WebSocket, ambiance up handlers and a mutter machine -- is comfortable

(nonetheless to be upright, I'd not even comprise conceived of this as a factor I
might maybe properly properly attain within the first location)

Set up textual content of all tabs to a file

$ cat mnt/tabs/by-identity/*/textual content.txt> text-of-all-tabs.txt

Flee script

$ echo '"inexperienced"'> mnt/tabs/closing-centered/attain-script
$ echo 'alert("hello!")'> mnt/tabs/closing-centered/attain-script

Reload an extension must you edit its present code

Snarl you'll very successfully be engaged on a Chrome extension (relatively than this
one). It be a misery to reload the extension (and presumably affected Web
pages) each time you substitute its code. There could possibly be a Stack Overflow

with methods to automate this, nonetheless they're all type of hacky. You will want
but one more extension, or it's well-known to tack queer permissions onto your
work-in-development extension, and also you do not upright get a current you will be able to
set off out of your editor or shell to refresh the extension.

TabFS capability that you just simply can attain all this in an customary shell
You determine not ought to put in writing any browser-side code in any respect.

This script turns an extension (this one's title is "Playgroundize
DevInstruments Protocol") off, then turns it encourage on, then reloads any tabs
that comprise the related pages open (on this case, I made up my ideas it's tabs
whose titles supply with "Chrome Dev"):

#!/bin/bash -eux
echo fake> mnt/extensions/Playg*/enabled
echo legitimate> mnt/extensions/Playg*/enabled
echo reload | tee mnt/tabs/by-title/Chrome_Dev*/assist a watch on

I mapped this script to Ctrl-. in my textual content editor, and now I upright hit
that each time I comprise to reload my extension code.

TODO: Dwell edit a working Web internet web page

edit internet web page.html within the tab folder. I command it may actually perchance properly properly upright stomp
outerHTML on the origin, in the end might maybe properly properly attain one thing further subtle

(it may actually perchance properly properly be frosty to comprise a continuous storage fantasy right here
moreover. I fancy the opinion that of being able to set arbitrary recordsdata wherever in
the subtree, undoubtedly, on story of then you definitely definately might maybe properly properly use git and emacs
autosave and stuff freed from cost... hmm)

TODO: Look expressions

$ contact mnt/tabs/closing-centered/watches/window.scrollY

Now you will be able to cat window.scrollY and understand the set up you might be scrolled on the
internet web page at any time.

May perchance presumably assemble an advert-hoc

round a Web internet web page: a bunch of terminal residence home windows floating round your
display, every sitting in a loop and the usage of cat to indicate display a apparent

TODO: Import information (JSON? XLS? JS?)

journey a JSON file foo.json into the imports subfolder of the tab
and it reveals up as a result of the merchandise in JS. (regulate in JS after which learn imports/foo.json and also you learn the
adjustments encourage?)

import a plotting library or no matter the identical method? dragging
plotlib.js into imports/plotlib.js after which calling
imports.plotlib() to invoke that JS file

the browser has totally different capability vitality as an interactive programming
ambiance, one the set up graphics design as
console I/O attain in most programming languages. i decide one thing that
holds it encourage that is underexplored is lack of functionality to upright... journey
recordsdata in and organize them with first rate instruments. many Web-based absolutely largely 'IDEs' comprise
to reinvent file administration, and many others from scratch, and it's fancy a
separate universe from the consolation of your laptop, and migrating
between one and the opposite is a correct misery (in characterize so that you can make the most of some
Python library to munge some information after which comprise a Web-based absolutely largely
visualization of it, as an example, or in characterize so that you can model recordsdata
within it, or assemble snapshots so that you just simply feel

trying stuff, and many others).

(what would the continuous storage fantasy right here be? localStorage? it's
attention-grabbing on story of I virtually want every tab to be much less of a
a lot much less
since now it's the positioning I'm dragging stuff to and it may actually perchance properly properly want some
continuous mutter attached. fancy, if I'm programming and modifying stuff
and saving within a tab's folder, that tab with out warning in fact
points; I
want it to survive as prolonged as a favourite file would, not like most browser
tabs lately)


disclaimer: this extension is an experiment. I decide it's frosty and
valuable and animated, and I on the general inch away it on, nonetheless I assemble no
ensures about efficiency or, particularly, safety. purposes
might maybe properly properly freeze, your browser might maybe properly properly freeze, there might maybe properly very successfully be methods for Web websites
to make the most of the extension to flee and rupture your laptop ... In some
sense, the total
of this
extension is to create a mountainous distinctive floor dwelling of dialog
between stuff within your browser and diagram on the consolation of your

Earlier than doing the leisure, clone this repository:

$ git clone

First, set up the browser extension.

Then, set up the C filesystem.

1. Set up the browser extension

(I decide for Opera or no matter different Chromium-based absolutely largely browser, you'll
get it to work, nonetheless you'll must substitute the native messaging route in
set Not apparent about Safari. perchance Edge too? whereas you moreover obtained
each factor to deliver collectively for Windows)

in Chrome

Race to the Chrome extensions internet web page. Enable
Developer mode (high-accurate nook).

Load-unpacked the extension/ folder on this repo.

Impact a showcase of the extension ID Chrome assigns. Mine is
jimpolemfaeckpjijgapgkmolankohgj. We will use this later.

in Firefox

You should put in as a "non everlasting extension", so it will handiest closing
to your most fashionable FF session. (TODO: is that this fixable? signature stuff?)

Race to about:debugging#/runtime/this-firefox.

Load Rapid Add-on...

Put off manifest.json within the extension subfolder of this repo.

2. Set up the C filesystem

First, assure you'll comprise FUSE and FUSE headers. On Linux, as an example,
sudo upright set up libfuse-dev or an equivalent. On macOS, get FUSE for

Then deliver collectively the C filesystem:

$ cd fs
$ mkdir mnt
$ assemble

Now set up the native messaging host into your browser, so the
extension can supply and talk about to the filesystem:

Chrome and Chromium

Change the extension ID you copied earlier for
jimpolemfaeckpjijgapgkmolankohgj within the current beneath.

$ ./set chrome jimpolemfaeckpjijgapgkmolankohgj


$ ./set chromium jimpolemfaeckpjijgapgkmolankohgj


$ ./set firefox

3. Ready!

Race encourage to chrome://extensions or
about:debugging#/runtime/this-firefox and reload the extension.

Now your browser tabs must be mounted in fs/mnt!

Open the background internet web page inspector to understand the filesystem operations
motion in. (in Chrome, click on on "background internet web page" subsequent to "Deem views"
within the extension's entry within the Chrome extensions internet web page; in Firefox,
click on on "Deem")

This console is moreover extremely priceless for debugging the leisure that
goes abominable, which doubtlessly will occur. (When you occur to get a generic I/O
error on the shell when working a current on TabFS, that doubtlessly
method that an exception happened which you will be able to confirm right here.)

(My OS and purposes are comfortable chatty. They attain totally different
operations, even after I set up not really feel fancy I'm undoubtedly doing
the leisure. My sense is that macOS is regularly chattier than Linux.)

Carry out

  • fs/: Native FUSE filesystem, written in C
    • tabfs.c:
      Talks to FUSE, implements fs operations, talks to extension. I
      not regularly must substitute this file; it basically is upright a stub
      that forwards each factor to the browser extension.
  • extension/: Browser extension, written in JS
    • background.js:
      Doubtlessly probably the most attention-grabbing file. Defines the general artificial recordsdata and
      what browser operations they invoke within the encourage of the scenes.

My understanding is that must you, as an example, cat
within the tab filesystem:

  1. cat to your laptop does a machine name open() down into macOS
    or Linux,

  2. macOS/Linux sees that this route is part of a FUSE filesystem, so it
    forwards the open() to the FUSE kernel module,

  3. FUSE forwards it to the tabfs_open implementation in our
    userspace filesystem in fs/tabfs.c,

  4. then tabfs_open rephrases the question as a JSON string and
    forwards it to our browser extension over stdout ('native

  5. our browser extension in extension/background.js will get the
    incoming message; it triggers the route for
    /tabs/by-identity/*/title.txt, which calls the browser extension API
    browser.tabs.get to get the information about tab ID 6377, together with
    its title,

  6. so when cat does learn() later, the title can get despatched encourage in
    a JSON native message to tabfs.c and at closing encourage to FUSE and the
    kernel and cat.

(little or no correct work happened right here, tbh. it's all upright

TODO: assemble diagrams?



issues that can perchance properly properly/must be achieved

  • add further artificial recordsdata!! be aware DOM nodes, snapshot most fashionable HTML of
    internet web page, spelunk into residing objects. understand what your code is doing. assemble
    further recordsdata writable moreover

  • assemble further (GUI and CLI) instruments on excessive, on both aspect

  • further persistence stuff. as I stated earlier, it may actually perchance properly properly moreover be frosty if
    you'll set arbitrary recordsdata within the subtrees, so .git, Mac prolonged
    attrs, editor temp recordsdata, and many others all work. assemble it able to behave fancy
    a 'correct' filesystem. moreover as I stated earlier, some weirdness within the
    proven fact that tabs are so disposable; they've a in fact different
    lifecycle from most elements of my correct filesystem. how you will be able to nudge that?

  • why can't Preview open images? GUI packages regularly struggle with the
    filesystem for some purpose. CLI further kindly

  • multithreading. the important thing constraint is that I'm going -s to
    fuse_main in tabfs.c, which makes each factor
    single-threaded. nonetheless I'm not explicit on how nice it may actually perchance properly properly toughen
    efficiency? perchance lots, nonetheless not apparent. perchance workload-dependent?

    the extension itself (and the stdin/stdout comm between the fs and
    the extension) would unexcited be single-threaded, nonetheless you'll
    interleave requests since most of that stuff is async. fancy the
    screenshot question that takes fancy half a second, you'll attain different
    stuff whereas prepared for the browser to get encourage to you on that (?)

    one more voice is that purposes have a tendency to carry if any
    explicit explicit particular person question hangs anyway; they set up not seem like looking out at for the
    filesystem to be so uninteresting (and to be beautiful to them, they undoubtedly comprise
    no method
    to). these types of issues might maybe properly very successfully be inevitable for any FUSE
    filesystem, even ones you'll buy are reasonably fight-examined and
    effectively-engineered fancy sshfs?

  • different efficiency stuff -- remembering once we're already attached
    to issues, reference counting, minimizing browser roundtrips. not
    apparent affect of those

  • TypeScript (how you will be prepared to realize with the minimal amount of assemble machine and
    tools supervisor nonsense?)

  • understand into assist for Firefox / Windows / Safari / and many others. best FUSE
    equiv for Windows? can you bridge to the a ways-off debugging APIs that
    all of them already must get the augmented efficiency? or upright
    implement all of it with JS monkey patching?

  • window administration. tab administration the set up you will be able to inch tabs. 'merge
    all residence home windows'


  • Processes as Files
    Julia Evans /proc comic lay out the
    customary /proc filesystem. it's very frosty! very dapper within the map during which it
    reapplies the current interface of recordsdata to the distinctive area of Unix
    processes. nonetheless how nice attain I care about Unix processes now? most
    packages that
    I care about engaged on my laptop lately are Web websites, no longer
    . so
    I comprise to seize the map during which of /proc -- 'convey the stuff you care
    about as a filesystem' -- and be aware it to one thing
    modern: the
    within of the browser. 'browser tabs as recordsdata'

  • there are two 'working applications' on my laptop, the browser and
    Unix, and Unix is by a methods the additional accessible and programmable and
    cohesive as a computing ambiance (it has concepts that type!
    shell, processes, recordsdata), even though it's arguably the a lot much less well-known
    to my day by day life. how can the browser seize on further of the properties
    of Unix?

  • it's manner too
    to assemble a
    browser extension. even 'assemble an extension' is a spoiled framing; it
    suggests making an extension is a whole Ingredient, a whole Project. fancy,
    why can't I upright seize a minute to inquire my browser a inquire or characterize it
    to automate one thing? lightness

  • totally different current makes use of of those browser assist a watch on APIs are in an
    automation context: testing your code on a robotic browser as part
    of some pipeline. I'm nice further contaminated about an interactive,
    end-user context.

Read More

Similar Products:

    None Found

Recent Content