complete-computing-environment/tabfs.org

133 lines
4.3 KiB
Org Mode

:PROPERTIES:
:ID: cce/tabfs
:ROAM_REFS: https://omar.website/tabfs/
:END:
#+TITLE: TabFS
#+ARROYO_HOME_MODULE: hm/tabfs.nix
#+ARROYO_SYSTEM_ROLE: endpoint
#+ARCOLOGY_KEY: cce/tabfs
#+ARCOLOGY_ALLOW_CRAWL: t
#+AUTO_TANGLE: t
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 [[id:cce/plasma_browser_integration][Plasma Browser Integration]] search which doesn't work any more with something much more powerful built around TabFS.
* NEXT do anything interesting with this
- [[id:cce/exwm_evil_firefox][exwm-evil-firefox]] commands?
- [[id:cce/capturing_tasks][Captures]]?
- populate a sqlite3 with last-active tab, history, etc?
* Installing in [[id:c75d20e6-8888-4c5a-ac97-5997e2f1c711][NixOS]] [[id:cce/home-manager][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 [[id:cce/firefox_nix][profile settings]]... some day this will get better, i hope! there surely has to be a way to get it going like in [[id:cce/the_standard_unix_password_manager][browserpass]]... generally, this can do a lot more with Chrom[ium|e] but I prefer Firefox.
- [[https://github.com/osnr/TabFS/issues/4][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:
#+begin_src nix :tangle ~/arroyo-nix/pkgs/tabfs.nix
{ 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
stdenv.mkDerivation rec {
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/";
};
}
#+end_src
#+begin_src nix :tangle ~/arroyo-nix/hm/tabfs.nix
{ 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";
};
}
#+end_src