NeoMutt  2025-09-05-55-g97fc89
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c File Reference

Config used by libsidebar. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "expando/lib.h"
#include "sort.h"
+ Include dependency graph for config.c:

Go to the source code of this file.

Functions

bool config_init_sidebar (struct ConfigSet *cs)
 Register sidebar config variables - Implements module_init_config_t -.
 

Variables

static const struct Mapping SidebarSortMethods []
 Sort methods for the sidebar.
 
static const struct ExpandoDefinition SidebarFormatDef []
 Expando definitions.
 
static struct ConfigDef SidebarVars []
 Config definitions for the sidebar.
 

Detailed Description

Config used by libsidebar.

Authors
  • Aditya De Saha
  • Pietro Cerutti
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file config.c.

Variable Documentation

◆ SidebarSortMethods

const struct Mapping SidebarSortMethods[]
static
Initial value:
= {
{ "count", SB_SORT_COUNT },
{ "desc", SB_SORT_DESC },
{ "flagged", SB_SORT_FLAGGED },
{ "path", SB_SORT_PATH },
{ "unread", SB_SORT_UNREAD },
{ "unsorted", SB_SORT_UNSORTED },
{ "alpha", SB_SORT_PATH },
{ "mailbox-order", SB_SORT_UNSORTED },
{ "name", SB_SORT_PATH },
{ "new", SB_SORT_UNREAD },
{ NULL, 0 },
}
@ SB_SORT_FLAGGED
Sort by count of flagged messages.
Definition sort.h:33
@ SB_SORT_COUNT
Sort by total message count.
Definition sort.h:31
@ SB_SORT_DESC
Sort by mailbox description.
Definition sort.h:32
@ SB_SORT_PATH
Sort by mailbox path (alphabetically)
Definition sort.h:34
@ SB_SORT_UNREAD
Sort by count of unread messages.
Definition sort.h:35
@ SB_SORT_UNSORTED
Sort into the order the mailboxes were configured.
Definition sort.h:36

Sort methods for the sidebar.

Definition at line 43 of file config.c.

43 {
44 // clang-format off
45 { "count", SB_SORT_COUNT },
46 { "desc", SB_SORT_DESC },
47 { "flagged", SB_SORT_FLAGGED },
48 { "path", SB_SORT_PATH },
49 { "unread", SB_SORT_UNREAD },
50 { "unsorted", SB_SORT_UNSORTED },
51 // Compatibility
52 { "alpha", SB_SORT_PATH },
53 { "mailbox-order", SB_SORT_UNSORTED },
54 { "name", SB_SORT_PATH },
55 { "new", SB_SORT_UNREAD },
56 { NULL, 0 },
57 // clang-format on
58};

◆ SidebarFormatDef

const struct ExpandoDefinition SidebarFormatDef[]
static
Initial value:
= {
{ "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
{ ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
{ "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
{ "!", "flagged", ED_SIDEBAR, ED_SID_FLAGGED, NULL },
{ "a", "notify", ED_SIDEBAR, ED_SID_NOTIFY, NULL },
{ "B", "name", ED_SIDEBAR, ED_SID_NAME, NULL },
{ "d", "deleted-count", ED_SIDEBAR, ED_SID_DELETED_COUNT, NULL },
{ "D", "description", ED_SIDEBAR, ED_SID_DESCRIPTION, NULL },
{ "F", "flagged-count", ED_SIDEBAR, ED_SID_FLAGGED_COUNT, NULL },
{ "L", "limited-count", ED_SIDEBAR, ED_SID_LIMITED_COUNT, NULL },
{ "n", "new-mail", ED_SIDEBAR, ED_SID_NEW_MAIL, NULL },
{ "N", "unread-count", ED_SIDEBAR, ED_SID_UNREAD_COUNT, NULL },
{ "o", "old-count", ED_SIDEBAR, ED_SID_OLD_COUNT, NULL },
{ "p", "poll", ED_SIDEBAR, ED_SID_POLL, NULL },
{ "r", "read-count", ED_SIDEBAR, ED_SID_READ_COUNT, NULL },
{ "S", "message-count", ED_SIDEBAR, ED_SID_MESSAGE_COUNT, NULL },
{ "t", "tagged-count", ED_SIDEBAR, ED_SID_TAGGED_COUNT, NULL },
{ "Z", "unseen-count", ED_SIDEBAR, ED_SID_UNSEEN_COUNT, NULL },
{ NULL, NULL, 0, -1, NULL }
}
@ ED_SIDEBAR
Sidebar ED_SID_ ExpandoDataSidebar.
Definition domain.h:54
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition domain.h:44
struct ExpandoNode * node_padding_parse(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Padding Expando - Implements ExpandoDefinition::parse() -.
@ ED_SID_FLAGGED_COUNT
Mailbox.msg_flagged.
Definition private.h:61
@ ED_SID_READ_COUNT
Mailbox.msg_count, Mailbox.msg_unread.
Definition private.h:69
@ ED_SID_DESCRIPTION
Mailbox.name.
Definition private.h:59
@ ED_SID_NEW_MAIL
Mailbox.has_new.
Definition private.h:65
@ ED_SID_UNSEEN_COUNT
Mailbox.msg_new.
Definition private.h:72
@ ED_SID_POLL
Mailbox.poll_new_mail.
Definition private.h:68
@ ED_SID_OLD_COUNT
Mailbox.msg_unread, Mailbox.msg_new.
Definition private.h:67
@ ED_SID_MESSAGE_COUNT
Mailbox.msg_count.
Definition private.h:63
@ ED_SID_LIMITED_COUNT
Mailbox.vcount.
Definition private.h:62
@ ED_SID_UNREAD_COUNT
Mailbox.msg_unread.
Definition private.h:71
@ ED_SID_TAGGED_COUNT
Mailbox.msg_tagged.
Definition private.h:70
@ ED_SID_NOTIFY
Mailbox.notify_user.
Definition private.h:66
@ ED_SID_NAME
SbEntry.box.
Definition private.h:64
@ ED_SID_DELETED_COUNT
Mailbox.msg_deleted.
Definition private.h:58
@ ED_SID_FLAGGED
Mailbox.msg_flagged.
Definition private.h:60
@ ED_GLO_PADDING_EOL
Padding to end-of-line.
Definition uid.h:38
@ ED_GLO_PADDING_HARD
Hard Padding.
Definition uid.h:39
@ ED_GLO_PADDING_SOFT
Soft Padding.
Definition uid.h:40

Expando definitions.

Config:

  • $sidebar_format

Definition at line 66 of file config.c.

66 {
67 // clang-format off
68 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
69 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
70 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
71 { "!", "flagged", ED_SIDEBAR, ED_SID_FLAGGED, NULL },
72 { "a", "notify", ED_SIDEBAR, ED_SID_NOTIFY, NULL },
73 { "B", "name", ED_SIDEBAR, ED_SID_NAME, NULL },
74 { "d", "deleted-count", ED_SIDEBAR, ED_SID_DELETED_COUNT, NULL },
75 { "D", "description", ED_SIDEBAR, ED_SID_DESCRIPTION, NULL },
76 { "F", "flagged-count", ED_SIDEBAR, ED_SID_FLAGGED_COUNT, NULL },
77 { "L", "limited-count", ED_SIDEBAR, ED_SID_LIMITED_COUNT, NULL },
78 { "n", "new-mail", ED_SIDEBAR, ED_SID_NEW_MAIL, NULL },
79 { "N", "unread-count", ED_SIDEBAR, ED_SID_UNREAD_COUNT, NULL },
80 { "o", "old-count", ED_SIDEBAR, ED_SID_OLD_COUNT, NULL },
81 { "p", "poll", ED_SIDEBAR, ED_SID_POLL, NULL },
82 { "r", "read-count", ED_SIDEBAR, ED_SID_READ_COUNT, NULL },
83 { "S", "message-count", ED_SIDEBAR, ED_SID_MESSAGE_COUNT, NULL },
84 { "t", "tagged-count", ED_SIDEBAR, ED_SID_TAGGED_COUNT, NULL },
85 { "Z", "unseen-count", ED_SIDEBAR, ED_SID_UNSEEN_COUNT, NULL },
86 { NULL, NULL, 0, -1, NULL }
87 // clang-format on
88};

◆ SidebarVars

struct ConfigDef SidebarVars[]
static

Config definitions for the sidebar.

Definition at line 93 of file config.c.

93 {
94 // clang-format off
95 { "sidebar_component_depth", DT_NUMBER, 0, 0, NULL,
96 "(sidebar) Strip leading path components from sidebar folders"
97 },
98 { "sidebar_delim_chars", DT_STRING, IP "/.", 0, NULL,
99 "(sidebar) Characters that separate nested folders"
100 },
101 { "sidebar_divider_char", DT_STRING, IP "\342\224\202", 0, NULL, // Box Drawings Light Vertical, U+2502
102 "(sidebar) Character to draw between the sidebar and index"
103 },
104 { "sidebar_folder_indent", DT_BOOL, false, 0, NULL,
105 "(sidebar) Indent nested folders"
106 },
107 { "sidebar_format", DT_EXPANDO|D_NOT_EMPTY, IP "%D%* %n", IP &SidebarFormatDef, NULL,
108 "(sidebar) printf-like format string for the sidebar panel"
109 },
110 { "sidebar_indent_string", DT_STRING, IP " ", 0, NULL,
111 "(sidebar) Indent nested folders using this string"
112 },
113 { "sidebar_new_mail_only", DT_BOOL, false, 0, NULL,
114 "(sidebar) Only show folders with new/flagged mail"
115 },
116 { "sidebar_next_new_wrap", DT_BOOL, false, 0, NULL,
117 "(sidebar) Wrap around when searching for the next mailbox with new mail"
118 },
119 { "sidebar_non_empty_mailbox_only", DT_BOOL, false, 0, NULL,
120 "(sidebar) Only show folders with a non-zero number of mail"
121 },
122 { "sidebar_on_right", DT_BOOL, false, 0, NULL,
123 "(sidebar) Display the sidebar on the right"
124 },
125 { "sidebar_short_path", DT_BOOL, false, 0, NULL,
126 "(sidebar) Abbreviate the paths using the `$folder` variable"
127 },
128 { "sidebar_sort", DT_SORT, SB_SORT_UNSORTED, IP SidebarSortMethods, NULL,
129 "(sidebar) Method to sort the sidebar"
130 },
131 { "sidebar_visible", DT_BOOL, false, 0, NULL,
132 "(sidebar) Show the sidebar"
133 },
134 { "sidebar_width", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 30, 0, NULL,
135 "(sidebar) Width of the sidebar"
136 },
137
138 { "sidebar_sort_method", DT_SYNONYM, IP "sidebar_sort", IP "2024-11-20" },
139
140 { NULL },
141 // clang-format on
142};
#define IP
Definition set.h:52
static const struct Mapping SidebarSortMethods[]
Sort methods for the sidebar.
Definition config.c:43
static const struct ExpandoDefinition SidebarFormatDef[]
Expando definitions.
Definition config.c:66
@ DT_NUMBER
a number
Definition types.h:38
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_EXPANDO
an expando
Definition types.h:34
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:79
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:100