nixos-config/user/firefox.nix
2024-09-05 22:13:38 -03:00

116 lines
3.5 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;
}
/* Make the url bar occupy the entire size of the container */
#nav-bar {
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 {
position: absolute;
right: 0;
top: 10px;
max-width: 50px;
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;
}
/* Make the private browser indicator look nice, over the close-window button */
#private-browsing-indicator-with-label {
position: absolute;
top: 4px;
left: 15px;
z-index: 20;
pointer-events: none;
}
#private-browsing-indicator-with-label > label {
display: none;
}
'';
};
};
};
wayland.windowManager.sway = {
extraConfig = ''
exec firefox
'';
};
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
MOZ_DISABLE_RDD_SANDBOX = "1";
};
};
}