From eec7fe580839c35108f12eb37834397048a50cea Mon Sep 17 00:00:00 2001 From: kenji Date: Mon, 5 Jan 2026 15:31:58 -0600 Subject: [PATCH] feat(firefox): implement robust modular newtab logic Uses a shell-based environment check in tridactylrc to set the newtab URL dynamically, allowing per-profile overrides without hardcoding URLs. --- apps/firefox/default.nix | 7 ++++--- apps/firefox/profiles/web-app.nix | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/firefox/default.nix b/apps/firefox/default.nix index f846d41..9baceff 100644 --- a/apps/firefox/default.nix +++ b/apps/firefox/default.nix @@ -16,7 +16,7 @@ ]; workspace = [ - "special:youtube, on-created-empty:uwsm app -- env TRIDACTYL_NEWTAB=https://youtube.com firefox -P YouTube --name youtube" + "special:youtube, on-created-empty:env TRIDACTYL_NEWTAB=https://youtube.com firefox -P YouTube --name youtube" ]; windowrulev2 = [ @@ -39,8 +39,9 @@ bind K tabprev unbind - " Set newtab from environment variable if available (provided by native messenger) - js tri.native.run("printenv TRIDACTYL_NEWTAB").then(r => { if (r.stdout.trim()) tri.config.set("newtab", r.stdout.trim()) }) + " Modular NewTab: Set from environment variable if provided by launch command + " Note: Uses 'r.content' for native command output + js tri.native.run("sh -c 'echo $TRIDACTYL_NEWTAB'").then(r => { let url = r.content.trim(); if (url) { tri.config.set("newtab", url); console.log("Tridactyl: Set newtab to " + url); } }).catch(e => console.error("Tridactyl NewTab Env Error:", e)) ''; programs.firefox = { diff --git a/apps/firefox/profiles/web-app.nix b/apps/firefox/profiles/web-app.nix index 57f807a..9323248 100644 --- a/apps/firefox/profiles/web-app.nix +++ b/apps/firefox/profiles/web-app.nix @@ -7,6 +7,8 @@ ... }: { inherit id name; + # Note: This profile relies on the global tridactylrc logic in default.nix + # to dynamically set 'newtab' via the TRIDACTYL_NEWTAB environment variable. search.force = true; search.default = "ddg"; extensions.force = true;