mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
firefox: Enable userChrome in about:config
Enable "toolkit.legacyUserProfileCustomizations.stylesheets" in about:config if userChrome or userContent is not empty.
This commit is contained in:
parent
a46e702093
commit
008a16529f
2 changed files with 50 additions and 6 deletions
|
@ -682,6 +682,12 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = let profile = config;
|
||||||
|
in {
|
||||||
|
settings."toolkit.legacyUserProfileCustomizations.stylesheets" =
|
||||||
|
mkIf (profile.userChrome != "" || profile.userContent != "") true;
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
default = { };
|
default = { };
|
||||||
description = "Attribute set of ${name} profiles.";
|
description = "Attribute set of ${name} profiles.";
|
||||||
|
@ -739,7 +745,25 @@ in {
|
||||||
(mkNoDuplicateAssertion cfg.profiles "profile")
|
(mkNoDuplicateAssertion cfg.profiles "profile")
|
||||||
] ++ (mapAttrsToList
|
] ++ (mapAttrsToList
|
||||||
(_: profile: mkNoDuplicateAssertion profile.containers "container")
|
(_: profile: mkNoDuplicateAssertion profile.containers "container")
|
||||||
cfg.profiles);
|
cfg.profiles) ++ (
|
||||||
|
# Assert "toolkit.legacyUserProfileCustomizations.stylesheets" is enabled if
|
||||||
|
# userChrome/userContent is used.
|
||||||
|
let
|
||||||
|
|
||||||
|
assertProfile = userChromeAttr: profile:
|
||||||
|
profile.${userChromeAttr} != ""
|
||||||
|
-> (profile.settings."toolkit.legacyUserProfileCustomizations.stylesheets"
|
||||||
|
!= false);
|
||||||
|
|
||||||
|
mkAssertion = userChromeAttr: {
|
||||||
|
assertion =
|
||||||
|
all (assertProfile userChromeAttr) (attrValues cfg.profiles);
|
||||||
|
message = ''
|
||||||
|
`${userChromeAttr}` won't work with `settings."toolkit.legacyUserProfileCustomizations.stylesheets"` set to false.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
in [ (mkAssertion "userChrome") (mkAssertion "userContent") ]);
|
||||||
|
|
||||||
warnings = optional (cfg.enableGnomeExtensions or false) ''
|
warnings = optional (cfg.enableGnomeExtensions or false) ''
|
||||||
Using '${moduleName}.enableGnomeExtensions' has been deprecated and
|
Using '${moduleName}.enableGnomeExtensions' has been deprecated and
|
||||||
|
|
|
@ -15,6 +15,9 @@ let
|
||||||
name = cfg.wrappedPackageName;
|
name = cfg.wrappedPackageName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
userChromeExample = "#example-user-chrome { display: none; }";
|
||||||
|
userContentExample = "#example-user-content { display: none; }";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
imports = [ firefoxMockOverlay ];
|
imports = [ firefoxMockOverlay ];
|
||||||
|
|
||||||
|
@ -160,12 +163,17 @@ in {
|
||||||
id = 5;
|
id = 5;
|
||||||
containers = {
|
containers = {
|
||||||
"shopping" = {
|
"shopping" = {
|
||||||
id = 6;
|
|
||||||
icon = "circle";
|
icon = "circle";
|
||||||
color = "yellow";
|
color = "yellow";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
profiles.userChrome = {
|
||||||
|
id = 6;
|
||||||
|
userChrome = userChromeExample;
|
||||||
|
userContent = userContentExample;
|
||||||
|
};
|
||||||
} // {
|
} // {
|
||||||
|
|
||||||
nmt.script = let
|
nmt.script = let
|
||||||
|
@ -199,10 +207,6 @@ in {
|
||||||
home-files/${cfg.configPath}/test/user.js \
|
home-files/${cfg.configPath}/test/user.js \
|
||||||
${withName ./profile-settings-expected-user.js}
|
${withName ./profile-settings-expected-user.js}
|
||||||
|
|
||||||
assertFileContent \
|
|
||||||
home-files/${cfg.configPath}/containers/containers.json \
|
|
||||||
${withName ./profile-settings-expected-containers.json}
|
|
||||||
|
|
||||||
bookmarksUserJs=$(normalizeStorePaths \
|
bookmarksUserJs=$(normalizeStorePaths \
|
||||||
home-files/${cfg.configPath}/bookmarks/user.js)
|
home-files/${cfg.configPath}/bookmarks/user.js)
|
||||||
|
|
||||||
|
@ -236,6 +240,22 @@ in {
|
||||||
assertFirefoxSearchContent \
|
assertFirefoxSearchContent \
|
||||||
home-files/${cfg.configPath}/searchWithoutDefault/search.json.mozlz4 \
|
home-files/${cfg.configPath}/searchWithoutDefault/search.json.mozlz4 \
|
||||||
${withName ./profile-settings-expected-search-without-default.json}
|
${withName ./profile-settings-expected-search-without-default.json}
|
||||||
|
|
||||||
|
assertFileContent \
|
||||||
|
home-files/${cfg.configPath}/containers/containers.json \
|
||||||
|
${withName ./profile-settings-expected-containers.json}
|
||||||
|
|
||||||
|
assertFileContains \
|
||||||
|
home-files/${cfg.configPath}/userChrome/user.js \
|
||||||
|
'user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true)'
|
||||||
|
|
||||||
|
assertFileContains \
|
||||||
|
home-files/${cfg.configPath}/userChrome/chrome/userChrome.css \
|
||||||
|
'${userChromeExample}'
|
||||||
|
|
||||||
|
assertFileContains \
|
||||||
|
home-files/${cfg.configPath}/userChrome/chrome/userContent.css \
|
||||||
|
'${userContentExample}'
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue