{ inputs, pkgs, ... }:
let
    zenPkg = inputs.zen-browser.packages.${pkgs.stdenv.system}.beta;
    exts = inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system};
    ffExtensions = {
        force = true;
        # packages = with inputs.firefox-addons.packages."${pkgs.system}"; [
        #     bitwarden
        #     darkreader
        #     ublock-origin
        #     stylus
        #     youtube-no-translation
        #     youtube-shorts-block
        # ];
        settings = {
            #"8dc198b5-81b3-4602-88d7-7cee2d4903b2".force = true;
            #"8dc198b5-81b3-4602-88d7-7cee2d4903b2".settings = lib.importJSON ./stylus_import.json;
            #"8dc198b5-81b3-4602-88d7-7cee2d4903b2".settings = import ./stylus_import.nix;
        };
    };
in
{
    programs.zen-browser = {
        enable = true;
        languagePacks = [
            "en-US"
            "pl"
            "de"
        ];
        profiles = {
            default = {
                id = 0;
                name = "default";
                isDefault = true;
                settings = builtins.fromJSON (builtins.readFile ./settings.json);
                userChrome = builtins.readFile ./userChrome.css;
                search = {
                    force = true;
                    default = "brave";
                    order = [ "brave" ];
                    engines = builtins.fromJSON (builtins.readFile ./search-engines.json);
                };
                extensions = {
                    packages = with exts; [
                        bitwarden
                        catppuccin-web-file-icons
                        # facebook-container
                        # facebook-tracking-removal
                        # google-container
                        linkwarden
                        #remove-youtube-s-suggestions
                        return-youtube-dislikes
                        simplelogin
                        stylus
                        ublock-origin
                        # web-scrobbler
                        # webxr-api-emulator
                        youtube-no-translation
                        youtube-shorts-block
                        #zen-internet
                    ];
                };
                mods = [
                    "a6335949-4465-4b71-926c-4a52d34bc9c0"
                    "f7c71d9a-bce2-420f-ae44-a64bd92975ab"
                    "906c6915-5677-48ff-9bfc-096a02a72379"
                    "f4866f39-cfd6-4498-ab92-54213b8279dc"
                    "e51b85e6-cef5-45d4-9fff-6986637974e1"
                ];
            };
        };
    };
    xdg.desktopEntries.zen-beta = {
        name = "Zen Browser";
        genericName = "Web Browser";
        exec = "${zenPkg}/bin/zen-beta --name zen-browser -P default %U";
        terminal = false;
        categories = [ "Network" "WebBrowser" ];
        mimeType = [
            "text/html"
            "text/xml"
            "application/xhtml+xml"
            "application/vnd.mozilla.xul+xml"
            "x-scheme-handler/http"
            "x-scheme-handler/https"
        ];
        icon = ./furryfox.png;
        actions = {
            "new-window" = {
                name = "New Window";
                exec = "${zenPkg}/bin/zen-beta --name zen-browser -P default --new-window %u";
            };
            "private-window" = {
                name = "New Private Window";
                exec = "${zenPkg}/bin/zen-browser --name zen-browser -P default --private-window %u";
            };
        };
        settings = {
            Type = "Application";
            Version = "1.4";
            StartupNotify = "true";
            StartupWMClass = "zen-browser";
        };
    };
}
