feat(firefox): set i18n settings

This commit is contained in:
Felix Schröter 2020-10-03 16:48:01 +02:00
parent 3918ea6548
commit 25bc0fbf3a
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58

View file

@ -4,7 +4,8 @@ with lib;
let let
firefox-addons = pkgs.nur.repos.rycee.firefox-addons; firefox-addons = pkgs.nur.repos.rycee.firefox-addons;
prefer-dark-theme = config.gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme; prefer-dark-theme =
config.gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme;
sharedSettings = { sharedSettings = {
# Privacy recommendations from https://www.privacytools.io/browsers/#about_config # Privacy recommendations from https://www.privacytools.io/browsers/#about_config
@ -29,14 +30,16 @@ let
# Theme # Theme
"ui.systemUsesDarkTheme" = prefer-dark-theme; "ui.systemUsesDarkTheme" = prefer-dark-theme;
"extensions.activeThemeID" = concatStrings "extensions.activeThemeID" = concatStrings [
[ "firefox-compact-" "firefox-compact-"
(if prefer-dark-theme then "dark" else "light") (if prefer-dark-theme then "dark" else "light")
"@mozilla.org" "@mozilla.org"
]; ];
"devtools.theme" = if prefer-dark-theme "devtools.theme" = if prefer-dark-theme then "dark" else "light";
then "dark"
else "light"; # i18n
"intl.accept_languages" = "en-GB, en";
"intl.regional_prefs.use_os_locales" = true;
# Other # Other
"browser.startup.page" = 3; "browser.startup.page" = 3;
@ -46,18 +49,14 @@ let
"signon.rememberSignons" = false; "signon.rememberSignons" = false;
"services.sync.engine.passwords" = false; "services.sync.engine.passwords" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false; "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false; "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" =
false;
"browser.newtabpage.activity-stream.feeds.snippets" = false; "browser.newtabpage.activity-stream.feeds.snippets" = false;
}; };
in in {
{
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = pkgs.firefox.override { package = pkgs.firefox.override { cfg = { enableFXCastBridge = true; }; };
cfg = {
enableFXCastBridge = true;
};
};
profiles = { profiles = {
private = { private = {
id = 0; id = 0;
@ -86,52 +85,54 @@ in
}; };
home.packages = let home.packages = let
escapeDesktopArg = arg: replaceStrings ["\""] ["\"\\\"\""] (toString arg); escapeDesktopArg = arg:
replaceStrings [ ''"'' ] [ ''"\""'' ] (toString arg);
makeFirefoxProfileDesktopItem = attrs: makeFirefoxProfileDesktopItem = attrs:
let let
mkExec = with lib; { name, profile, ... }: '' mkExec = with lib;
firefox -p "${ escapeDesktopArg profile }" --class="firefox-${ escapeDesktopArg name }" { name, profile, ... }: ''
''; firefox -p "${escapeDesktopArg profile}" --class="firefox-${
in escapeDesktopArg name
pkgs.makeDesktopItem ((removeAttrs attrs [ "profile" ]) // { }"
exec = mkExec attrs;
extraEntries = ''
StartupWMClass="${ escapeDesktopArg attrs.name }"
''; '';
}); in pkgs.makeDesktopItem ((removeAttrs attrs [ "profile" ]) // {
exec = mkExec attrs;
extraEntries = ''
StartupWMClass="${escapeDesktopArg attrs.name}"
'';
});
makeFirefoxWebAppDesktopItem = attrs: makeFirefoxWebAppDesktopItem = attrs:
let let
# --class not yet respected: https://bugzilla.mozilla.org/show_bug.cgi?id=1606247 # --class not yet respected: https://bugzilla.mozilla.org/show_bug.cgi?id=1606247
mkExec = with lib; { app, name, profile ? "private", ... }: '' mkExec = with lib;
firefox -p "${ escapeDesktopArg profile }" --ssb="${ escapeDesktopArg app }" --class="${ escapeDesktopArg name }" { app, name, profile ? "private", ... }: ''
''; firefox -p "${escapeDesktopArg profile}" --ssb="${
in escapeDesktopArg app
pkgs.makeDesktopItem ((removeAttrs attrs [ "app" "profile" ]) // { }" --class="${escapeDesktopArg name}"
exec = mkExec attrs;
extraEntries = ''
StartupWMClass="${ escapeDesktopArg attrs.name }"
''; '';
}); in pkgs.makeDesktopItem ((removeAttrs attrs [ "app" "profile" ]) // {
in exec = mkExec attrs;
(with pkgs; [ extraEntries = ''
(tor-browser-bundle-bin.override { pulseaudioSupport = true; }) StartupWMClass="${escapeDesktopArg attrs.name}"
]) '';
++ [ });
(makeFirefoxProfileDesktopItem { in (with pkgs;
name = "firefox-work"; [ (tor-browser-bundle-bin.override { pulseaudioSupport = true; }) ]) ++ [
desktopName = "Firefox (Work)"; (makeFirefoxProfileDesktopItem {
icon = "firefox"; # TODO looks different name = "firefox-work";
profile = "work"; desktopName = "Firefox (Work)";
}) icon = "firefox"; # TODO looks different
(makeFirefoxWebAppDesktopItem { profile = "work";
name = "element"; })
desktopName = "Element"; (makeFirefoxWebAppDesktopItem {
app = "https://app.element.io"; name = "element";
}) desktopName = "Element";
(makeFirefoxWebAppDesktopItem { app = "https://app.element.io";
name = "youtube-music"; })
desktopName = "YouTube Music"; (makeFirefoxWebAppDesktopItem {
app = "https://music.youtube.com"; name = "youtube-music";
}) desktopName = "YouTube Music";
]; app = "https://music.youtube.com";
})
];
} }