From 047dc0bd2144930f1805c118daa5a96cb94f1cb0 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 1 Dec 2024 20:51:45 +0000 Subject: [PATCH] firefox: port to native vertical tabs it's not perfect; i can hopefully tweak this more but committing this now because firefox is insanely fragile about these preferences and i don't know that i could recreate these withoput another hour of testing --- hosts/common/programs/firefox/addons.nix | 2 +- hosts/common/programs/firefox/default.nix | 47 ++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/hosts/common/programs/firefox/addons.nix b/hosts/common/programs/firefox/addons.nix index e6398ccbb..3add0b5c5 100644 --- a/hosts/common/programs/firefox/addons.nix +++ b/hosts/common/programs/firefox/addons.nix @@ -52,7 +52,7 @@ in enable = lib.mkDefault false; }; sidebery = { - enable = lib.mkDefault true; + enable = lib.mkDefault false; # firefox 133+ has native vertical tabs (about:config `sidebar.*`) }; sponsorblock = { enable = lib.mkDefault true; diff --git a/hosts/common/programs/firefox/default.nix b/hosts/common/programs/firefox/default.nix index 9aa21c371..12997e895 100644 --- a/hosts/common/programs/firefox/default.nix +++ b/hosts/common/programs/firefox/default.nix @@ -204,11 +204,22 @@ in # N.B.: `overrides.cfg` might be librewolf-specific -- not supported by mainline firefox. # firefox does support per-profile `user.js` files which have similar functionality. + # actually, i think this can be expressed in a firefox-compatible manner: + # - fs.".mozilla/firefox/firefox.overrides.cfg".symlink.text = '' + // DEFAULT OPTION VALUES: + // common tweaks: + // // use `pref(...)` to force a preference // use `defaultPref(...)` to allow runtime reconfiguration + // use `lockPref(...)` to prevent the preferences from being changed at runtime (incl preventing firefox from updating them itself) // discover preference names via the `about:config` page - // + // N.B.: supported option values appear to be: + // - string + // - bool + // - number + // anything else (e.g. arrays, objects) MUST be represented as strings (use backticks for multiline/raw strings) + // if we can't query the revocation status of a SSL cert because the issuer is offline, // treat it as unrevoked. // see: @@ -219,6 +230,9 @@ in // DISABLE DNS OVER HTTPS; use the system resolver. defaultPref("network.trr.mode", 5); + // enable webGL + defaultPref("webgl.disabled", false); + // scrollbar configuration, see: // style=4 gives rectangular scrollbars // could also enable "always show scrollbars" in about:preferences -- not sure what the actual pref name for that is @@ -239,8 +253,34 @@ in defaultPref("widget.use-xdg-desktop-portal.open-uri", 1); defaultPref("browser.toolbars.bookmarks.visibility", "never"); + + // enable vertical tab view, like Sidebery (but loses the top-window horizontal tabs) + // defaultPref("browser.toolbarbuttons.introduced.sidebar-button", true); + defaultPref("sidebar.animation.enable", false); + defaultPref("sidebar.backupState", `{"width":"","command":"","expanded":true,"hidden":false}`); + defaultPref("sidebar.main.tools", "history"); + defaultPref("sidebar.revamp", true); + defaultPref("sidebar.verticalTabs", true); + // vvv default is for tabs button to toggle tab icons v.s. tab icons + description. + // "hide-sidebar" => toggle between tab icons + description and NO visibility at all. + defaultPref("sidebar.visibility", "hide-sidebar"); + // configure which extensions are visible by default (TODO: requires a lot of trial and error) // defaultPref("browser.uiCustomization.state", ...); + // defaultPref("browser.uiCustomization.horizontalTabStrip", ["firefox-view-button","tabbrowser-tabs","new-tab-button","alltabs-button"]); + defaultPref("browser.uiCustomization.state", `{"placements":{ + "widget-overflow-fixed-list":[], + "unified-extensions-area":["browserpass_maximbaz_com-browser-action","magnolia_12_34-browser-action"], + "nav-bar":["firefox-view-button","new-tab-button","alltabs-button","unified-extensions-button","urlbar-container","forward-button","back-button","ublock0_raymondhill_net-browser-action","sponsorblocker_ajay_app-browser-action","sidebar-button"], + "toolbar-menubar":["menubar-items"], + "TabsToolbar":[], + "vertical-tabs":["tabbrowser-tabs"],"PersonalToolbar":["import-button","personal-bookmarks"]}, + "seen":["save-to-pocket-button","developer-button","browserpass_maximbaz_com-browser-action","magnolia_12_34-browser-action","ublock0_raymondhill_net-browser-action","sponsorblocker_ajay_app-browser-action"], + "dirtyAreaCache":["nav-bar","TabsToolbar","vertical-tabs","PersonalToolbar","unified-extensions-area","toolbar-menubar"], + "currentVersion":20, + "newElementCount":0 + }`); + defaultPref("browser.uiCustomization.horizontalTabstrip", `["firefox-view-button","tabbrowser-tabs"]`); // auto-open specific URI schemes without prompting: defaultPref("network.protocol-handler.external.xdg-open", true); // for firefox-xdg-open extension @@ -253,10 +293,15 @@ in // - type `w thing` into the URL bar to search "thing" on Wikipedia. // - to add a search shortcut: right-click any search box => "Add a keyword for this search". // - to update the static bookmarks, export via Hamburger => bookmarks => manage bookmarks => Import and Backup => Export Bookmarks To HTML + defaultPref("browser.bookmarks.addedImportButton", true); defaultPref("browser.places.importBookmarksHTML", true); defaultPref("browser.bookmarks.file", "~/.mozilla/firefox/bookmarks.html"); defaultPref("browser.startup.homepage", "https://uninsane.org/places"); + + + // browser.engagement.sidebar-button.has-used + // browser.migration.version = 150 ''; fs.".mozilla/firefox/bookmarks.html".symlink.target = ./bookmarks.html;