mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
thunderbird: add accountsOrder option (#6310)
Fixes #5031 and adds accountsOrder option for declarative account ordering in Thunderbird's folder pane as discussed in the issue.
This commit is contained in:
@@ -320,6 +320,33 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
accountsOrder = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Custom ordering of accounts and local folders in
|
||||
Thunderbird's folder pane. The accounts are specified
|
||||
by their name. For declarative accounts, it must be the name
|
||||
of their attribute in `config.accounts.email.accounts` (or
|
||||
`config.programs.thunderbird.profiles.<name>.feedAccounts`
|
||||
for feed accounts). The local folders name can be found in
|
||||
the `mail.accountmanager.accounts` Thunderbird preference,
|
||||
for example with Settings > Config Editor ("account1" by
|
||||
default). Enabled accounts and local folders that aren't
|
||||
listed here appear in an arbitrary order after the ordered
|
||||
accounts.
|
||||
'';
|
||||
example = ''
|
||||
[
|
||||
"my-awesome-account"
|
||||
"private"
|
||||
"work"
|
||||
"rss"
|
||||
/* Other accounts in arbitrary order */
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
withExternalGnupg = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -659,14 +686,33 @@ in
|
||||
);
|
||||
|
||||
accounts = emailAccounts ++ feedAccounts;
|
||||
|
||||
orderedAccounts =
|
||||
let
|
||||
accountNameToId = builtins.listToAttrs (
|
||||
map (a: {
|
||||
name = a.name;
|
||||
value = "account_${a.id}";
|
||||
}) accounts
|
||||
);
|
||||
|
||||
accountsOrderIds = map (a: accountNameToId."${a}" or a) profile.accountsOrder;
|
||||
|
||||
# Append the default local folder name "account1".
|
||||
# See https://github.com/nix-community/home-manager/issues/5031.
|
||||
enabledAccountsIds = (lib.attrsets.mapAttrsToList (name: value: value) accountNameToId) ++ [
|
||||
"account1"
|
||||
];
|
||||
in
|
||||
accountsOrderIds ++ (lib.lists.subtractLists accountsOrderIds enabledAccountsIds);
|
||||
in
|
||||
{
|
||||
text = mkUserJs (builtins.foldl' (a: b: a // b) { } (
|
||||
[
|
||||
cfg.settings
|
||||
|
||||
(optionalAttrs (length accounts != 0) {
|
||||
"mail.accountmanager.accounts" = concatStringsSep "," (map (a: "account_${a.id}") accounts);
|
||||
(optionalAttrs (length orderedAccounts != 0) {
|
||||
"mail.accountmanager.accounts" = concatStringsSep "," orderedAccounts;
|
||||
})
|
||||
|
||||
(optionalAttrs (length smtp != 0) {
|
||||
|
||||
@@ -6,7 +6,7 @@ user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da
|
||||
user_pref("mail.account.account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.server", "server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.accountmanager.accounts", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab,imperative_account,account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account1");
|
||||
user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.attachPgpKey", false);
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.autoEncryptDrafts", true);
|
||||
|
||||
@@ -6,7 +6,7 @@ user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da
|
||||
user_pref("mail.account.account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.server", "server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.accountmanager.accounts", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab,imperative_account,account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account1");
|
||||
user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.attachPgpKey", false);
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.autoEncryptDrafts", true);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
user_pref("general.useragent.override", "");
|
||||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.accountmanager.accounts", "account1,account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false);
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr.");
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.htmlSigText", "");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
user_pref("general.useragent.override", "");
|
||||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.accountmanager.accounts", "account1,account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false);
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr.");
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.htmlSigText", "");
|
||||
|
||||
@@ -77,6 +77,13 @@
|
||||
'';
|
||||
|
||||
feedAccounts.rss = { };
|
||||
|
||||
accountsOrder = [
|
||||
"hm@example.com"
|
||||
"rss"
|
||||
"imperative_account"
|
||||
"hm-account"
|
||||
];
|
||||
};
|
||||
|
||||
second.settings = {
|
||||
@@ -87,6 +94,7 @@
|
||||
3
|
||||
];
|
||||
};
|
||||
second.accountsOrder = [ "account1" ];
|
||||
};
|
||||
|
||||
settings = {
|
||||
|
||||
Reference in New Issue
Block a user