old
 1{
 2  pkgs,
 3  pkgs-stable,
 4  config,
 5  lib,
 6  myvars,
 7  ...
 8}: let
 9  getThunderbirdAccountPath = accountName: profileName: let
10    accountId = builtins.hashString "sha256" accountName;
11    thunderbirdProfilesPath = ".thunderbird";
12  in "${config.home.homeDirectory}/${thunderbirdProfilesPath}/${profileName}/ImapMail/${accountId}";
13  thunderbird-x = pkgs-stable.thunderbird.overrideAttrs (oldAttrs: {
14    makeWrapperArgs = oldAttrs.makeWrapperArgs ++ ["--set" "MOZ_ENABLE_WAYLAND" "0"];
15  });
16in {
17  programs.thunderbird = {
18    enable = true;
19    package = thunderbird-x;
20    profiles.Default = {
21      isDefault = true;
22      settings = {
23        "extensions.autoDisableScopes" = 0;
24        "mail.spellcheck.inline" = false;
25      };
26    };
27  };
28
29  catppuccin.thunderbird.profile = "Default";
30
31  accounts.email.accounts = {
32    "${myvars.useremail}".thunderbird.enable = true;
33    "hpcesia@outlook.com".thunderbird.enable = true;
34  };
35
36  home.packages = with pkgs; [
37    birdtray
38  ];
39
40  xdg.configFile."birdtray-config.json" = {
41    force = true;
42    text = builtins.toJSON (
43      (builtins.fromJSON (builtins.readFile ./birdtray-default-config.json))
44      // {
45        accounts =
46          lib.mapAttrsToList (n: v: {
47            path = "${getThunderbirdAccountPath v.name "Default"}/INBOX.msf";
48          })
49          (lib.filterAttrs (n: v: v.thunderbird.enable) config.accounts.email.accounts);
50      }
51      // (lib.mapAttrs' (n: v: lib.nameValuePair "common/${n}" v) {
52        launchthunderbird = true;
53        exitthunderbirdonquit = true;
54        defaultcolor = "#c6a0f6"; # Catppucin Macchiato Mauve
55        hideWhenStartedManually = false;
56        hidewhenminimized = true;
57        hidewhenrestarted = true;
58        hidewhenstarted = true;
59        showhidethunderbird = true;
60        restartthunderbird = true;
61        startClosedThunderbird = true;
62      })
63      // (lib.mapAttrs' (n: v: lib.nameValuePair "advanced/${n}" v) {
64        tbcmdline = [(lib.getExe thunderbird-x)];
65        tbwindowmatch = "Thunderbird";
66        updateOnStartup = false;
67        unreadopacitylevel = 0.80;
68      })
69    );
70  };
71}