thunderbird: add userChrome and userContent options

Add an option to the Thunderbird module that allows specifying CSS for
userChrome and userContent styling

PR #3808
This commit is contained in:
Matthew_Cash 2023-03-25 13:57:47 -07:00 committed by Robert Helgesson
parent 6e57fc4705
commit 28698126bd
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 42 additions and 0 deletions

View file

@ -157,6 +157,28 @@ in {
example = true;
description = "Allow using external GPG keys with GPGME.";
};
userChrome = mkOption {
type = types.lines;
default = "";
description = "Custom Thunderbird user chrome CSS.";
example = ''
/* Hide tab bar in Thunderbird */
#tabs-toolbar {
visibility: collapse !important;
}
'';
};
userContent = mkOption {
type = types.lines;
default = "";
description = "Custom Thunderbird user content CSS.";
example = ''
/* Hide scrollbar on Thunderbird pages */
*{scrollbar-width:none !important}
'';
};
};
}));
};
@ -276,6 +298,12 @@ in {
"${thunderbirdConfigPath}/profiles.ini" =
mkIf (cfg.profiles != { }) { text = generators.toINI { } profilesIni; };
}] ++ flip mapAttrsToList cfg.profiles (name: profile: {
"${thunderbirdProfilesPath}/${name}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") { text = profile.userChrome; };
"${thunderbirdProfilesPath}/${name}/chrome/userContent.css" =
mkIf (profile.userContent != "") { text = profile.userContent; };
"${thunderbirdProfilesPath}/${name}/user.js" = let
accounts = filter (a:
a.thunderbird.profiles == [ ]

View file

@ -35,6 +35,12 @@
first = {
isDefault = true;
withExternalGnupg = true;
userChrome = ''
* { color: blue !important; }
'';
userContent = ''
* { color: red !important; }
'';
};
second.settings = { "second.setting" = "some-test-setting"; };
@ -60,5 +66,13 @@
assertFileExists home-files/.thunderbird/second/user.js
assertFileContent home-files/.thunderbird/second/user.js \
${./thunderbird-expected-second.js}
assertFileExists home-files/.thunderbird/first/chrome/userChrome.css
assertFileContent home-files/.thunderbird/first/chrome/userChrome.css \
<(echo "* { color: blue !important; }")
assertFileExists home-files/.thunderbird/first/chrome/userContent.css
assertFileContent home-files/.thunderbird/first/chrome/userContent.css \
<(echo "* { color: red !important; }")
'';
}