Skip to content

Commit f7b73af

Browse files
Add config option for the notification timeout duration
1 parent 73aaa44 commit f7b73af

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

doc/toxic.conf.5

+5
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ How often in seconds to auto\-save the Tox data file\&. (integer; 0 to disable)
133133
Maximum lines for chat window history\&. Integer value\&. (for example: 700)
134134
.RE
135135
.PP
136+
\fBnotification_timeout\fR
137+
.RS 4
138+
Time in milliseconds to display a notification\&. (for example: 3000)
139+
.RE
140+
.PP
136141
\fBline_join\fR
137142
.RS 4
138143
Indicator for when someone connects or joins a group\&. Three characters max for line_ settings\&.

doc/toxic.conf.5.asc

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ OPTIONS
8484
*history_size*;;
8585
Maximum lines for chat window history. Integer value. (for example: 700)
8686

87+
*notification_timeout*;;
88+
Time in milliseconds to display a notification. Integer value. (for example: 3000)
89+
8790
*line_join*;;
8891
Indicator for when someone connects or joins a group.
8992
Three characters max for line_ settings.

misc/toxic.conf.example

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ ui = {
5353
// maximum lines for chat window history
5454
history_size=700;
5555

56+
// time in milliseconds to display a notification
57+
notification_timeout=3000;
58+
5659
// Indicator for display when someone connects or joins a group.
5760
line_join="-->";
5861

src/settings.c

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static struct ui_strings {
5858
const char *native_colors;
5959
const char *autolog;
6060
const char *history_size;
61+
const char *notification_timeout;
6162
const char *show_typing_self;
6263
const char *show_typing_other;
6364
const char *show_welcome_msg;
@@ -86,6 +87,7 @@ static struct ui_strings {
8687
"native_colors",
8788
"autolog",
8889
"history_size",
90+
"notification_timeout",
8991
"show_typing_self",
9092
"show_typing_other",
9193
"show_welcome_msg",
@@ -114,6 +116,7 @@ static void ui_defaults(struct user_settings *settings)
114116
settings->bell_on_invite = 0;
115117
settings->colour_theme = DFLT_COLS;
116118
settings->history_size = 700;
119+
settings->notification_timeout = 3000;
117120
settings->show_typing_self = SHOW_TYPING_ON;
118121
settings->show_typing_other = SHOW_TYPING_ON;
119122
settings->show_welcome_msg = SHOW_WELCOME_MSG_ON;
@@ -372,6 +375,7 @@ int settings_load(struct user_settings *s, const char *patharg)
372375
config_setting_lookup_bool(setting, ui_strings.show_connection_msg, &s->show_connection_msg);
373376

374377
config_setting_lookup_int(setting, ui_strings.history_size, &s->history_size);
378+
config_setting_lookup_int(setting, ui_strings.notification_timeout, &s->notification_timeout);
375379
config_setting_lookup_int(setting, ui_strings.nodeslist_update_freq, &s->nodeslist_update_freq);
376380
config_setting_lookup_int(setting, ui_strings.autosave_freq, &s->autosave_freq);
377381

src/settings.h

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct user_settings {
4949

5050
int colour_theme; /* boolean (0 for default toxic colours) */
5151
int history_size; /* int between MIN_HISTORY and MAX_HISTORY */
52+
int notification_timeout;
5253
int show_typing_self; /* boolean */
5354
int show_typing_other; /* boolean */
5455
int show_welcome_msg; /* boolean */

src/toxic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ int main(int argc, char **argv)
13321332

13331333
#endif /* PYTHON */
13341334

1335-
init_notify(60, 3000);
1335+
init_notify(60, user_settings->notification_timeout);
13361336

13371337
/* screen/tmux auto-away timer */
13381338
if (init_mplex_away_timer(m) == -1) {

0 commit comments

Comments
 (0)