dotfiles/modules/desktop/apps/firefox.nix

138 lines
4.3 KiB
Nix

{
inputs,
config,
...
}: {
flake.modules.nixos.desktop = {
programs.firefox.enable = true;
};
flake.modules.homeManager.desktop = {pkgs, ...}: let
system = pkgs.stdenv.hostPlatform.system;
ff-addons = inputs.firefox-addons.packages.${system};
in {
stylix.targets.firefox.profileNames = [config.flake.meta.user.name];
programs.firefox = {
enable = true;
profiles.${config.flake.meta.user.name} = {
settings = {
"browser.startup.homepage" = "about:blank";
"browser.newtabpage.pinned" = [
{
title = "New Tab";
url = "about:blank";
}
];
"sidebar.revamp" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
};
extensions.packages = with ff-addons; [
ublock-origin
sponsorblock
bitwarden
darkreader
youtube-shorts-block
sidebery
];
userChrome = ''
/**
* Hide sidebar-panel-header (sidebar.revamp: true)
*/
#sidebar-panel-header {
display: none;
}
/**
* Dynamic styles
*
* Choose when styles below will be activated (comment/uncomment line)
* - When Sidebery set title preface "."
* - When Sidebery sidebar is active
*/
#main-window[titlepreface="."] {
/* #main-window:has(#sidebar-box[sidebarcommand="_3c078156-979c-498b-8990-85f7987dd929_-sidebar-action"][checked="true"]) { */
/* Hide horizontal native tabs toolbar */
#TabsToolbar > * {
display: none !important;
}
/* Hide top window border */
#nav-bar {
border-color: transparent !important;
}
/* Hide new Firefox sidebar, restyle addon's sidebar */
#sidebar-main, #sidebar-launcher-splitter {
display: none !important;
}
#sidebar-box {
padding: 0 !important;
}
#sidebar-box #sidebar {
box-shadow: none !important;
border: none !important;
outline: none !important;
border-radius: 0 !important;
}
#sidebar-splitter {
--splitter-width: 3px !important;
min-width: var(--splitter-width) !important;
width: var(--splitter-width) !important;
padding: 0 !important;
margin: 0 calc(-1*var(--splitter-width) + 1px) 0 0 !important;
border: 0 !important;
opacity: 0 !important;
}
/* Update background color of the #browser area (it's visible near the
rounded corner of the web page) so it blends with sidebery color with
vertical nav-bar. */
/* #browser {
background-color: var(--lwt-accent-color) !important;
background-image: none !important;
} */
/* Hide sidebar header (sidebar.revamp: false) */
#sidebar-header {
display: none !important;
}
/* Uncomment the block below to show window buttons in Firefox nav-bar
(maybe, I didn't test it on non-linux-tiled-wm env) */
/* #nav-bar > .titlebar-buttonbox-container,
#nav-bar > .titlebar-buttonbox-container > .titlebar-buttonbox {
display: flex !important;
} */
/* Uncomment one of the lines below if you need space near window buttons */
/* #nav-bar > .titlebar-spacer[type="pre-tabs"] { display: flex !important; } */
/* #nav-bar > .titlebar-spacer[type="post-tabs"] { display: flex !important; } */
}
#TabsToolbar {
visibility: collapse !important;
}
'';
search.engines = {
"Unduck" = {
urls = [
{
template = "https://unduck.link";
params = [
{
name = "q";
value = "{searchTerms}";
}
];
}
];
definedAliases = ["@un"];
};
};
search.default = "Unduck";
search.force = true;
};
};
};
}