nixos-config/user/firefox.nix
2024-08-20 14:15:58 -03:00

109 lines
3.2 KiB
Nix

{
config,
pkgs,
lib,
font,
...
}:
let
inherit (config.my) desktop browser;
in
{
config = {
programs.firefox = {
enable = true;
package = pkgs.firefox-devedition;
profiles = {
dev-edition-default = {
isDefault = true;
search.force = true;
search.default = "DuckDuckGo";
settings = {
"devtools.theme" = "auto";
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"browser.tabs.inTitlebar" = if desktop == "sway" then 0 else 1;
"sidebar.position_start" = false; # Move sidebar to the right
# enable media RDD to allow gpu acceleration
"media.rdd-ffmpeg.enabled" = true;
"media.rdd-ffvpx.enabled" = true;
"media.rdd-opus.enabled" = true;
"media.rdd-process.enabled" = true;
"media.rdd-retryonfailure.enabled" = true;
"media.rdd-theora.enabled" = true;
"media.rdd-vorbis.enabled" = true;
"media.rdd-vpx.enabled" = true;
"media.rdd-wav.enabled" = true;
"media.av1.enabled" = true;
"media.ffmpeg.vaapi-drm-display.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.ffvpx.enabled" = true;
"gfx.webrender.all" = true;
# Enable installing non signed extensions
"extensions.langpacks.signatures.required" = false;
"xpinstall.signatures.required" = false;
"browser.aboutConfig.showWarning" = false;
# Enable userChrome editor (Ctrl+Shift+Alt+I)
"devtools.chrome.enabled" = true;
"devtools.debugger.remote-enabled" = true;
};
userChrome =
if desktop == "sway" then
''
#titlebar { display: none !important; }
#sidebar-header { display: none !important; }
''
else
''
/* Hide tabs and other items */
.toolbar-items {
display: none;
}
/* Create a horizontal container */
#navigator-toolbox {
display: grid;
grid-template-columns: 1fr 50px;
}
/* Make the url bar occupy the entire size of the container */
#nav-bar {
grid-column: 1 / 3;
grid-row: 1;
z-index: 1;
padding-right: 29px !important;
}
/* shrink the tab bar to a small size, since it's only the window close button basically */
#titlebar {
max-width: 50px;
grid-area: 1 / 2;
z-index: 10;
}
/* Add a nice border to the top of the window */
#nav-bar {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
'';
};
};
};
wayland.windowManager.sway = {
extraConfig = ''
exec firefox
'';
};
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
MOZ_DISABLE_RDD_SANDBOX = "1";
};
};
}