From 28698126bd825aff21cae9ffd15cf83e169051b0 Mon Sep 17 00:00:00 2001 From: Matthew_Cash Date: Sat, 25 Mar 2023 13:57:47 -0700 Subject: [PATCH] thunderbird: add userChrome and userContent options Add an option to the Thunderbird module that allows specifying CSS for userChrome and userContent styling PR #3808 --- modules/programs/thunderbird.nix | 28 +++++++++++++++++++ .../programs/thunderbird/thunderbird.nix | 14 ++++++++++ 2 files changed, 42 insertions(+) diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index 8c5a4b868..efd3b7821 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -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 == [ ] diff --git a/tests/modules/programs/thunderbird/thunderbird.nix b/tests/modules/programs/thunderbird/thunderbird.nix index ee16efa06..776be0f70 100644 --- a/tests/modules/programs/thunderbird/thunderbird.nix +++ b/tests/modules/programs/thunderbird/thunderbird.nix @@ -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; }") ''; }