From 101ebb3eee8872dd9d045b4dd0045a6577390b0c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 28 May 2026 15:28:31 -0500 Subject: [PATCH] [feat] adding zen browser --- flake.lock | 59 ++++++++- flake.nix | 3 +- home/home.nix | 1 + home/modules/zen/default.nix | 242 ++++++++++++++++++++++++++++++++++ home/modules/zen/policies.nix | 95 +++++++++++++ home/modules/zen/search.nix | 163 +++++++++++++++++++++++ 6 files changed, 561 insertions(+), 2 deletions(-) create mode 100644 home/modules/zen/default.nix create mode 100644 home/modules/zen/policies.nix create mode 100644 home/modules/zen/search.nix diff --git a/flake.lock b/flake.lock index 59b4c26..fa9e687 100644 --- a/flake.lock +++ b/flake.lock @@ -591,6 +591,27 @@ "type": "github" } }, + "home-manager_3": { + "inputs": { + "nixpkgs": [ + "zen", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1778805320, + "narHash": "sha256-nGFJ01m2CTBKD4ABtcY4vLhHrRN91LKr/pn41PcU78A=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "9846abe15e7d0d36b8acbd4d05f2b87461744c92", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "jovian": { "inputs": { "nix-github-actions": "nix-github-actions_2", @@ -975,6 +996,22 @@ "type": "indirect" } }, + "nixpkgs_13": { + "locked": { + "lastModified": 1778443072, + "narHash": "sha256-zi7/fsqM/kFdNuED//4WOCUtezGtKKqRNORjMvfwjnA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "da5ad661ba4e5ef59ba743f0d112cbc30e474f32", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1777954456, @@ -1244,7 +1281,8 @@ "octotype": "octotype", "quickemu": "quickemu", "simple-nixos-mailserver": "simple-nixos-mailserver", - "stylix": "stylix" + "stylix": "stylix", + "zen": "zen" } }, "rust-analyzer-src": { @@ -1570,6 +1608,25 @@ "repo": "xwayland-satellite", "type": "github" } + }, + "zen": { + "inputs": { + "home-manager": "home-manager_3", + "nixpkgs": "nixpkgs_13" + }, + "locked": { + "lastModified": 1779955179, + "narHash": "sha256-cHrbJ8pZrsFWUTJVk7AxWiEg5eiZptPQxtT0YXMIENo=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "c341e3f6516fb1286d25b99d34b111f93028ae87", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 1863d71..4b0766f 100644 --- a/flake.nix +++ b/flake.nix @@ -35,11 +35,12 @@ }; anipy-cli = { url = "github:sdaqo/anipy-cli"; }; darkly = { url = "github:Bali10050/Darkly"; }; + zen = { url = "github:0xc000022070/zen-browser-flake"; }; }; outputs = inputs@{ nixpkgs, nixpkgs-stable, home-manager, quickemu, nixos-hardware, emacs, nix-bitcoin, octotype, - simple-nixos-mailserver, anipy-cli, darkly, niri, + simple-nixos-mailserver, anipy-cli, darkly, niri, zen, stylix, self, affinity-nix, chaotic, ... }: let system = "x86_64-linux"; diff --git a/home/home.nix b/home/home.nix index 2a6e947..40e9865 100644 --- a/home/home.nix +++ b/home/home.nix @@ -9,6 +9,7 @@ in { ./modules/hyprland.nix ./modules/niri.nix ./modules/rofi.nix + ./modules/zen/default.nix # ags.homeManagerModules.default # ./modules/plasma.nix ]; diff --git a/home/modules/zen/default.nix b/home/modules/zen/default.nix new file mode 100644 index 0000000..a0f7c34 --- /dev/null +++ b/home/modules/zen/default.nix @@ -0,0 +1,242 @@ +{ + inputs, + libx, + pkgs, + lib, + ... +}: { + imports = [ + inputs.zen-browser.homeModules.beta + ]; + + programs.zen-browser = { + enable = true; + languagePacks = ["en-US"]; + policies = import ./policies.nix; + + setAsDefaultBrowser = true; + enablePrivateDesktopEntry = true; + + profiles.default = rec { + settings = { + "zen.workspaces.continue-where-left-off" = true; + "zen.workspaces.natural-scroll" = true; + "zen.view.compact.hide-tabbar" = true; + "zen.view.compact.hide-toolbar" = true; + "zen.view.compact.animate-sidebar" = false; + "zen.welcome-screen.seen" = true; + "zen.urlbar.behavior" = "float"; + }; + + sine = { + enable = true; + mods = [ + "253a3a74-0cc4-47b7-8b82-996a64f030d5" # Floating History + "4ab93b88-151c-451b-a1b7-a1e0e28fa7f8" # No Sidebar Scrollbar + "7190e4e9-bead-4b40-8f57-95d852ddc941" # Tab title fixes + "803c7895-b39b-458e-84f8-a521f4d7a064" # Hide Inactive Workspaces + "906c6915-5677-48ff-9bfc-096a02a72379" # Floating Status Bar + "a6335949-4465-4b71-926c-4a52d34bc9c0" # Better Find Bar + "c6813222-6571-4ba6-8faf-58f3343324f6" # Disable Rounded Corners + "c8d9e6e6-e702-4e15-8972-3596e57cf398" # Zen Back Forward + "cb15abdb-0514-4e09-8ce5-722cf1f4a20f" # Hide Extension Name + "d8b79d4a-6cba-4495-9ff6-d6d30b0e94fe" # Better Active Tab + "e122b5d9-d385-4bf8-9971-e137809097d0" # No Top Sites + "f7c71d9a-bce2-420f-ae44-a64bd92975ab" # Better Unloaded Tabs + "fd24f832-a2e6-4ce9-8b19-7aa888eb7f8e" # Quietify + "context-menu-icons" + ]; + }; + + # bookmarks = import ./bookmarks-config.nix {inherit libx lib;}; + + search = import ./search.nix {inherit pkgs;}; + + # liveFolders = { + # "Prisma blog" = { + # workspace = spaces."Rendezvous".id; + # kind = "rss"; + # title = "Prisma blog"; + # feedUrl = "https://www.prisma.io/blog/rss.xml"; + # folderIcon = "https://www.prisma.io/favicon.ico"; + # position = 400; + # maxItems = 3; + # collapsed = true; + # timeRange = 0; + # }; + + # "Oscar Liang" = { + # workspace = spaces."Rendezvous".id; + # kind = "rss"; + # title = "Oscar Liang"; + # feedUrl = "https://oscarliang.com/feed"; + # folderIcon = "https://oscarliang.com/wp-content/uploads/2021/06/favicon.ico"; + # position = 401; + # maxItems = 5; + # collapsed = true; + # timeRange = 0; + # }; + # }; + + pinsForce = true; + pinsForceAction = "demote"; + pins = let + stateDir = { + "State" = { + id = "482bc905-c00c-4c49-8a56-367668bf70b9"; + workspace = spaces."Rendezvous".id; + folderIcon = "chrome://browser/skin/zen-icons/selectable/eye.svg"; + isGroup = true; + isFolderCollapsed = true; + editedTitle = true; + position = 200; + }; + }; + in + { + "NixOS.org" = { + id = "d8494475-ed8d-4746-a867-54fa7700faf4"; + url = "https://nixos.org/"; + workspace = spaces."Rendezvous".id; + position = 151; + }; + "GrapheneOS" = { + id = "19266f40-575f-49f8-8fe0-ac13659a4242"; + url = "https://grapheneos.org/"; + workspace = spaces."Rendezvous".id; + position = 152; + }; + } + // stateDir; + + joinedTabs."Kernel and NixOS" = { + id = "kernel-nix-docs"; + gridType = "vsep"; + tabs = [ + pins."NixOS.org".id + pins."GrapheneOS".id + ]; + sizes = [40 20 40]; + }; + + containersForce = true; + + spacesForce = true; + spaces = { + "Rendezvous" = { + id = "572910e1-4468-4832-a869-0b3a93e2f165"; + icon = "chrome://browser/skin/zen-icons/selectable/navigate.svg"; + position = 1000; + theme = { + type = "gradient"; + colors = [ + { + red = 123; + green = 56; + blue = 58; + algorithm = "analogous"; + type = "explicit-lightness"; + lightness = 35; + position.x = 301; + position.y = 176; + primary = true; + custom = false; + } + { + red = 123; + green = 110; + blue = 55; + algorithm = "analogous"; + type = "explicit-lightness"; + lightness = 35; + position.x = 260; + position.y = 271; + primary = false; + custom = false; + } + { + red = 122; + green = 56; + blue = 114; + algorithm = "analogous"; + type = "explicit-lightness"; + lightness = 35; + position.x = 255; + position.y = 84; + primary = false; + custom = false; + } + ]; + opacity = 0.8; + texture = 0.5; + }; + }; + "Research" = { + id = "ec287d7f-d910-4860-b400-513f269dee77"; + icon = "chrome://browser/skin/zen-icons/selectable/logo-rss.svg"; + position = 1001; + theme = { + type = "gradient"; + colors = [ + { + red = 171; + green = 219; + blue = 227; + algorithm = "floating"; + type = "explicit-lightness"; + } + ]; + opacity = 0.2; + texture = 0.5; + }; + }; + }; + + keyboardShortcutsVersion = 19; + keyboardShortcuts = [ + { + id = "zen-compact-mode-toggle"; + key = "c"; + modifiers.control = true; + modifiers.alt = true; + } + { + id = "zen-toggle-sidebar"; + key = "x"; + modifiers.control = true; + modifiers.alt = true; + } + { + id = "key_savePage"; + key = "s"; + modifiers.control = true; + } + { + id = "key_quitApplication"; + disabled = true; + } + { + id = "zen-copy-url"; + disabled = true; + } + { + id = "addBookmarkAsKb"; + disabled = true; + } + { + id = "key_reload"; + key = "r"; + modifiers.control = true; + } + { + id = "key_reload_skip_cache"; + key = "r"; + modifiers = { + control = true; + shift = true; + }; + } + ]; + }; + }; +} diff --git a/home/modules/zen/policies.nix b/home/modules/zen/policies.nix new file mode 100644 index 0000000..9ca2a51 --- /dev/null +++ b/home/modules/zen/policies.nix @@ -0,0 +1,95 @@ +let + mkLockedAttrs = builtins.mapAttrs (_: value: { + Value = value; + Status = "locked"; + }); + + mkPluginUrl = id: "https://addons.mozilla.org/firefox/downloads/latest/${id}/latest.xpi"; + + mkExtensionEntry = { + id, + pinned ? false, + }: let + base = { + install_url = mkPluginUrl id; + installation_mode = "force_installed"; + }; + in + if pinned + then base // {default_area = "navbar";} + else base; + + mkExtensionSettings = builtins.mapAttrs (_: entry: + if builtins.isAttrs entry + then entry + else mkExtensionEntry {id = entry;}); +in { + AutofillAddressEnabled = true; + AutofillCreditCardEnabled = false; + DisableAppUpdate = true; + DisableFeedbackCommands = true; + DisableFirefoxStudies = true; + DisablePocket = true; # save webs for later reading + DisableTelemetry = true; + DontCheckDefaultBrowser = true; + OfferToSaveLogins = false; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + SanitizeOnShutdown = { + FormData = true; + Cache = true; + }; + ExtensionSettings = mkExtensionSettings { + "uBlock0@raymondhill.net" = mkExtensionEntry { + id = "ublock-origin"; + pinned = true; + }; + # about:debugging#/runtime/this-firefox + # "{0814291e-c531-4741-a8e7-9a3e8f62bf71}" = "remove-youtube-tracking"; + # "{3579f63b-d8ee-424f-bbb6-6d0ce3285e6a}" = "chameleon-ext"; + # "{4590d8b8-3569-46e3-a571-cabfbaeab2c1}" = "no-youtube-shorts"; + "{74145f27-f039-47ce-a470-a662b129930a}" = "clearurls"; + "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = "return-youtube-dislikes"; + "{85860b32-02a8-431a-b2b1-40fbd64c9c69}" = "github-file-icons"; + "{861a3982-bb3b-49c6-bc17-4f50de104da1}" = "custom-user-agent-revived"; + "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}" = "refined-github-"; + "{ef9e884b-b6d8-4544-b0de-82c46c5e95de}" = "sponsorblock"; + # "{fef652df-dd80-450e-b64a-567abeb3aa4b}" = "youtube-cards"; + "@searchengineadremover" = "searchengineadremover"; + "firefox-extension@steamdb.info" = "steam-database"; + "github-no-more@ihatereality.space" = "github-no-more"; + "github-repository-size@pranavmangal" = "gh-repo-size"; + "jid1-BoFifL9Vbdl2zQ@jetpack" = "decentraleyes"; + }; + Preferences = mkLockedAttrs { + "browser.aboutConfig.showWarning" = false; + "browser.tabs.warnOnClose" = false; + "media.videocontrols.picture-in-picture.video-toggle.enabled" = true; + # Disable swipe gestures (Browser:BackOrBackDuplicate, Browser:ForwardOrForwardDuplicate) + "browser.gesture.swipe.left" = ""; + "browser.gesture.swipe.right" = ""; + "browser.tabs.hoverPreview.enabled" = true; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.topsites.contile.enabled" = false; + "browser.translations.enable" = false; + + "privacy.resistFingerprinting" = true; + "privacy.resistFingerprinting.randomization.canvas.use_siphash" = true; + "privacy.resistFingerprinting.randomization.daily_reset.enabled" = true; + "privacy.resistFingerprinting.randomization.daily_reset.private.enabled" = true; + "privacy.resistFingerprinting.block_mozAddonManager" = true; + "privacy.spoof_english" = 1; + + "privacy.firstparty.isolate" = true; + "network.cookie.cookieBehavior" = 5; + "dom.battery.enabled" = false; + + "gfx.webrender.all" = true; + "network.http.http3.enabled" = true; + "network.socket.ip_addr_any.disabled" = true; # disallow bind to 0.0.0.0 + }; +} diff --git a/home/modules/zen/search.nix b/home/modules/zen/search.nix new file mode 100644 index 0000000..f23d207 --- /dev/null +++ b/home/modules/zen/search.nix @@ -0,0 +1,163 @@ +{pkgs, ...}: { + force = true; + default = "searx"; + privateDefault = "searx"; + engines = let + nixSnowflakeIcon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + in { + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "channel"; + value = "unstable"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = nixSnowflakeIcon; + definedAliases = ["@pkgs"]; + }; + "Nix Options" = { + urls = [ + { + template = "https://search.nixos.org/options"; + params = [ + { + name = "channel"; + value = "unstable"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = nixSnowflakeIcon; + definedAliases = ["@nop"]; + }; + "Home Manager Options" = { + urls = [ + { + template = "https://home-manager-options.extranix.com/"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + { + name = "release"; + value = "master"; # unstable + } + ]; + } + ]; + icon = nixSnowflakeIcon; + definedAliases = ["hmop"]; + }; + + "Google Maps" = { + urls = [ + { + template = "http://maps.google.com"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["@maps" "@gmaps"]; + }; + "StartPage" = { + urls = [ + { + template = "https://www.startpage.com/sp/search"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["@startpage" "@sp" "@pp"]; + icon = "https://www.startpage.com/sp/cdn/favicons/favicon-gradient.ico"; + updateInterval = 24 * 60 * 60 * 1000; + }; + "searx" = { + urls = [ + { + template = "https://search.tfcconnection.org"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["s"]; + }; + + MakerWorld = { + urls = [ + { + template = "https://makerworld.com/en/search/models"; + params = [ + { + name = "keyword"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["@maker" "@mw"]; + }; + + Printables = { + urls = [ + { + template = "https://www.printables.com/search/models"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["@pt" "@print" "@printables"]; + }; + + "ChatGPT" = { + urls = [ + { + template = "https://chat.openai.com"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "https://chatgpt.com/cdn/assets/favicon-eex17e9e.ico"; + definedAliases = ["@gpt" "@chat" "@chatgpt"]; + }; + + bing.metaData.hidden = "true"; + }; +}