TabFS is a FUSE filesystem which exposes browser state to arbitrary filesystem tools. Powerful little thing but doesn't really fit in to my system at the moment. I would love to be able to replace my Plasma Browser Integration search which doesn't work any more with something much more powerful built around TabFS.
NEXT do anything interesting with this
- exwm-evil-firefox commands?
- Captures?
- populate a sqlite3 with last-active tab, history, etc?
Installing in NixOS home-manager
It has to be installed as a "temporary add-on" every time firefox is started up unless i move to the nightly and set some profile flags in my profile settings… some day this will get better, i hope! there surely has to be a way to get it going like in browserpass… generally, this can do a lot more with Chrom[ium|e] but I prefer Firefox.
- Answer: Firefox plugin signing and the "temporary add-on constraint"
- https://github.com/NixOS/nixpkgs/issues/108154 nixpkgs pull request containing this temporary gist which doesn't work on Chromium:
{ stdenv, lib, fetchFromGitHub, fuse,
callPackage,
withChromium ? false,
chromeExtensionId ? "" }:
let
commonManifest = {
name = "com.rsnous.tabfs";
description = "TabFS";
path = "@out@/bin/tabfs";
type = "stdio";
allowed_extensions = ["tabfs@rsnous.com"];
};
in
let
versions = lib.pkgVersions;
in
rec {
stdenv.mkDerivation pname = "tabfs";
version = versions.tabfs-rev;
src = callPackage versions.tabfs-fetch {};
preBuild = ''
makeFlagsArray+=('CFLAGS+=-I${fuse}/include -L${fuse}/lib $(CFLAGS_EXTRA)')
cd fs/
'';
passAsFile = [
"firefoxManifest"
"chromiumManifest"
"chromiumExtensionPatch"
];
chromiumExtensionPatch = ''
diff --git a/extension/manifest.json b/extension/manifest.json
index 022cf27..3f4e715 100644
--- a/extension/manifest.json
+++ b/extension/manifest.json
@@ -14,11 +14,5 @@
"background": {
"scripts": ["vendor/browser-polyfill.js", "background.js"],
"persistent": true
- },
-
- "browser_specific_settings": {
- "gecko": {
- "id": "tabfs@rsnous.com"
- }
}
}
'';
firefoxManifest = builtins.toJSON commonManifest;
chromiumManifest = lib.optionalString withChromium
(builtins.toJSON (commonManifest // {
allowed_origins = [ "chrome-extension://${chromeExtensionId}/" ];
}));
postBuild = ''
cd ..
substituteAll $firefoxManifestPath firefox.json
${lib.optionalString withChromium "substituteAll $chromiumManifestPath chromium.json"}
'';
installPhase = ''
mkdir -p $out/bin $out/lib/mozilla/native-messaging-hosts $out/share/tabfs/extension-firefox
install -Dm0755 fs/tabfs $out/bin
install -Dm0644 firefox.json $out/lib/mozilla/native-messaging-hosts/com.rsnous.tabfs.json
cp -r extension/* $out/share/tabfs/extension-firefox
'' + lib.optionalString withChromium ''
install -Dm644 chromium.json $out/etc/chromium/native-messaging-hosts/com.rsnous.tabfs.json
patch -p1 < "$chromiumExtensionPatchPath"
mkdir -p $out/share/tabfs/extension-chromium
cp -r extension/* $out/share/tabfs/extension-chromium
'';
meta = with lib; {
description = "Mount your browser tabs as a filesystem.";
license = licenses.gpl3;
platforms = lib.platforms.linux;
homepage = "https://omar.website/tabfs/";
};
}
{ pkgs, ... }:
let
pkg = pkgs.callPackage ../pkgs/tabfs.nix {};
in
{
home.packages = [ pkg ];
home.file = {
".mozilla/native-messaging-hosts/com.rsnous.tabfs.json".source =
"${pkg}/lib/mozilla/native-messaging-hosts/com.rsnous.tabfs.json";
};
# ofc you need to mkdir this yourself, probably
home.sessionVariables = {
TABFS_MOUNT_DIR = "$HOME/tabs";
};
}