From 5b1b420ac0dce4768e473fd11e4b2de3f1492638 Mon Sep 17 00:00:00 2001 From: Marvin Ewald Date: Thu, 21 Jul 2016 11:25:40 +0200 Subject: [PATCH] Add further explanation to the beep_on* options This also renames beep_on* to bell_on*. --- doc/toxic.conf.5 | 46 ++++++++++++++++++++++------------------- doc/toxic.conf.5.asc | 31 +++++++++++++++------------ misc/toxic.conf.example | 18 ++++++++-------- src/chat.c | 18 ++++++++-------- src/groupchat.c | 4 ++-- src/settings.c | 40 +++++++++++++++++------------------ src/settings.h | 8 +++---- 7 files changed, 87 insertions(+), 78 deletions(-) diff --git a/doc/toxic.conf.5 b/doc/toxic.conf.5 index 3f81cae..40c1d75 100644 --- a/doc/toxic.conf.5 +++ b/doc/toxic.conf.5 @@ -85,27 +85,7 @@ Time format string for logging enclosed by double quotes\&. See .PP \fBalerts\fR .RS 4 -Enable or disable terminal alerts on events\&. true or false -.RE -.PP -\fBbeep_on_message\fR -.RS 4 -Beep when receiving a message\&. true or false -.RE -.PP -\fBbeep_on_filetrans\fR -.RS 4 -Beep when receiving a filetransfer\&. true or false -.RE -.PP -\fBbeep_on_filetrans_accept\fR -.RS 4 -Beep when a filetransfer was accepted\&. true or false -.RE -.PP -\fBbeep_on_invite\fR -.RS 4 -Beep when receiving a group/call invite\&. true or false +Enable or disable acoustic alerts on events\&. true or false .RE .PP \fBnative_colors\fR @@ -172,6 +152,30 @@ Set user status when attaching and detaching from GNU screen or tmux\&. true or .RS 4 Status message to set when status is set to away due to screen/tmux detach\&. When attaching, the status message is set back to the original value\&. .RE +.PP +The following options control whether to output a terminal bell on certain events\&. +.br +Some terminals mark the window as urgent when a bell is received\&. Urgent windows are usually highlighted in the taskbar and some window managers even provide shortcuts to jump to the next urgent window\&. These options don't affect the "alerts" option\&. +.PP +\fBbell_on_message\fR +.RS 4 +Enable/Disable the terminal bell when receiving a message\&. true or false +.RE +.PP +\fBbell_on_filetrans\fR +.RS 4 +Enable/Disable the terminal bell when receiving a filetransfer\&. true or false +.RE +.PP +\fBbell_on_filetrans_accept\fR +.RS 4 +Enable/Disable the terminal bell when a filetransfer was accepted\&. true or false +.RE +.PP +\fBbell_on_invite\fR +.RS 4 +Enable/Disable the terminal bell when receiving a group/call invite\&. true or false +.RE .RE .PP \fBaudio\fR diff --git a/doc/toxic.conf.5.asc b/doc/toxic.conf.5.asc index 6f2c87c..8e0b22f 100644 --- a/doc/toxic.conf.5.asc +++ b/doc/toxic.conf.5.asc @@ -55,19 +55,7 @@ OPTIONS See *date*(1) *alerts*;; - Enable or disable terminal alerts on events. true or false - - *beep_on_message* - Beep when receiving a message. true or false - - *beep_on_filetrans* - Beep when receiving a filetransfer. true or false - - *beep_on_filetrans_accept* - Beep when a filetransfer was accepted. true or false - - *beep_on_invite* - Beep when receiving a group/call invite. true or false + Enable or disable acoustic alerts on events. true or false *native_colors*;; Select between native terminal colors and toxic color theme. true or false @@ -112,6 +100,23 @@ OPTIONS detach. When attaching, the status message is set back to the original value. + The following options control whether to output a terminal bell on certain events. + Some terminals mark the window as urgent when a bell is received. Urgent windows are usually highlighted in the taskbar and some window managers even provide shortcuts to jump to the next urgent window. + These options don't affect the "alerts" option. + + *bell_on_message* + Enable/Disable the terminal bell when receiving a message. true or false + + *bell_on_filetrans* + Enable/Disable the terminal bell when receiving a filetransfer. true or false + + *bell_on_filetrans_accept* + Enable/Disable the terminal bell when a filetransfer was accepted. true or false + + *bell_on_invite* + Enable/Disable the terminal bell when receiving a group/call invite. true or false + + *audio*:: Configuration related to audio devices. diff --git a/misc/toxic.conf.example b/misc/toxic.conf.example index 3923482..c162cdf 100644 --- a/misc/toxic.conf.example +++ b/misc/toxic.conf.example @@ -5,20 +5,20 @@ ui = { // true to enable timestamps, false to disable timestamps=true; - // true to enable terminal alerts on messages, false to disable + // true to enable acoustic alerts on messages, false to disable alerts=true; - // Beep when receiving a message - beep_on_message=true + // Output a bell when receiving a message (see manpage) + bell_on_message=true - // Beep when receiving a filetransfer - beep_on_filetrans=true + // Output a bell when receiving a filetransfer (see manpage) + bell_on_filetrans=true - // Don't beep when a filetransfer was accepted - beep_on_filetrans_accept=false + // Don't output a bell when a filetransfer was accepted (see manpage) + bell_on_filetrans_accept=false - // Beep when receiving a group/call invite - beep_on_invite=true + // Output a bell when receiving a group/call invite (see manpage) + bell_on_invite=true // true to use native terminal colours, false to use toxic default colour theme native_colors=false; diff --git a/src/chat.c b/src/chat.c index 04e4901..3df5288 100644 --- a/src/chat.c +++ b/src/chat.c @@ -160,10 +160,10 @@ static void recv_message_helper(ToxWindow *self, Tox *m, uint32_t num, const cha write_to_log(msg, nick, ctx->log, false); if (self->active_box != -1) - box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message, + box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message, self->active_box, "%s", msg); else - box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message, + box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message, &self->active_box, nick, "%s", msg); } @@ -176,10 +176,10 @@ static void recv_action_helper(ToxWindow *self, Tox *m, uint32_t num, const char write_to_log(action, nick, ctx->log, true); if (self->active_box != -1) - box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message, + box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message, self->active_box, "* %s %s", nick, action ); else - box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message, + box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message, &self->active_box, self->name, "* %s %s", nick, action ); } @@ -458,7 +458,7 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, uint32_t friendnum, uint char progline[MAX_STR_SIZE]; init_progress_bar(progline); line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", progline); - sound_notify(self, silent, NT_NOFOCUS | user_settings->beep_on_filetrans_accept | NT_WNDALERT_2, NULL); + sound_notify(self, silent, NT_NOFOCUS | user_settings->bell_on_filetrans_accept | NT_WNDALERT_2, NULL); ft->line_id = self->chatwin->hst->line_end->id + 2; } else if (ft->state == FILE_TRANSFER_PAUSED) { /* transfer is resumed */ ft->state = FILE_TRANSFER_STARTED; @@ -600,10 +600,10 @@ static void chat_onFileRecv(ToxWindow *self, Tox *m, uint32_t friendnum, uint32_ tox_file_get_file_id(m, friendnum, filenum, ft->file_id, NULL); if (self->active_box != -1) - box_notify2(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->beep_on_filetrans, + box_notify2(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->bell_on_filetrans, self->active_box, "Incoming file: %s", filename ); else - box_notify(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->beep_on_filetrans, + box_notify(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->bell_on_filetrans, &self->active_box, self->name, "Incoming file: %s", filename ); } @@ -627,7 +627,7 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, ui Friends.list[friendnumber].group_invite.length = length; Friends.list[friendnumber].group_invite.type = type; - sound_notify(self, generic_message, NT_WNDALERT_2 | user_settings->beep_on_invite, NULL); + sound_notify(self, generic_message, NT_WNDALERT_2 | user_settings->bell_on_invite, NULL); char name[TOX_MAX_NAME_LENGTH]; get_nick_truncate(m, name, friendnumber); @@ -655,7 +655,7 @@ void chat_onInvite (ToxWindow *self, ToxAV *av, uint32_t friend_number, int stat line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Incoming audio call! Type: \"/answer\" or \"/reject\""); if (self->ringing_sound == -1) - sound_notify(self, call_incoming, NT_LOOP | user_settings->beep_on_invite, &self->ringing_sound); + sound_notify(self, call_incoming, NT_LOOP | user_settings->bell_on_invite, &self->ringing_sound); if (self->active_box != -1) box_silent_notify2(self, NT_NOFOCUS | NT_WNDALERT_0, self->active_box, "Incoming audio call!"); diff --git a/src/groupchat.c b/src/groupchat.c index c481f6d..0e58cf3 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -258,7 +258,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int /* Only play sound if mentioned by someone else */ if (strcasestr(msg, selfnick) && strcmp(selfnick, nick)) { - sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->beep_on_message, NULL); + sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->bell_on_message, NULL); if (self->active_box != -1) box_silent_notify2(self, NT_NOFOCUS, self->active_box, "%s %s", nick, msg); @@ -296,7 +296,7 @@ static void groupchat_onGroupAction(ToxWindow *self, Tox *m, int groupnum, int p selfnick[n_len] = '\0'; if (strcasestr(action, selfnick)) { - sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->beep_on_message, NULL); + sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->bell_on_message, NULL); if (self->active_box != -1) box_silent_notify2(self, NT_NOFOCUS, self->active_box, "* %s %s", nick, action ); diff --git a/src/settings.c b/src/settings.c index 1d82e39..cef92a2 100644 --- a/src/settings.c +++ b/src/settings.c @@ -51,10 +51,10 @@ static struct ui_strings { const char* timestamp_format; const char* log_timestamp_format; const char* alerts; - const char* beep_on_message; - const char* beep_on_filetrans; - const char* beep_on_filetrans_accept; - const char* beep_on_invite; + const char* bell_on_message; + const char* bell_on_filetrans; + const char* bell_on_filetrans_accept; + const char* bell_on_invite; const char* native_colors; const char* autolog; const char* history_size; @@ -77,10 +77,10 @@ static struct ui_strings { "timestamp_format", "log_timestamp_format", "alerts", - "beep_on_message", - "beep_on_filetrans", - "beep_on_filetrans_accept", - "beep_on_invite", + "bell_on_message", + "bell_on_filetrans", + "bell_on_filetrans_accept", + "bell_on_invite", "native_colors", "autolog", "history_size", @@ -104,10 +104,10 @@ static void ui_defaults(struct user_settings* settings) settings->autolog = AUTOLOG_OFF; settings->alerts = ALERTS_ENABLED; - settings->beep_on_message = 0; - settings->beep_on_filetrans = 0; - settings->beep_on_filetrans_accept = 0; - settings->beep_on_invite = 0; + settings->bell_on_message = 0; + settings->bell_on_filetrans = 0; + settings->bell_on_filetrans_accept = 0; + settings->bell_on_invite = 0; settings->colour_theme = DFLT_COLS; settings->history_size = 700; settings->show_typing_self = SHOW_TYPING_ON; @@ -332,17 +332,17 @@ int settings_load(struct user_settings *s, const char *patharg) config_setting_lookup_bool(setting, ui_strings.alerts, &s->alerts); - if (config_setting_lookup_bool(setting, ui_strings.beep_on_message, &s->beep_on_message)) { - s->beep_on_message = s->beep_on_message ? NT_BEEP : 0; + if (config_setting_lookup_bool(setting, ui_strings.bell_on_message, &s->bell_on_message)) { + s->bell_on_message = s->bell_on_message ? NT_BEEP : 0; } - if (config_setting_lookup_bool(setting, ui_strings.beep_on_filetrans, &s->beep_on_filetrans)) { - s->beep_on_filetrans = s->beep_on_filetrans ? NT_BEEP : 0; + if (config_setting_lookup_bool(setting, ui_strings.bell_on_filetrans, &s->bell_on_filetrans)) { + s->bell_on_filetrans = s->bell_on_filetrans ? NT_BEEP : 0; } - if (config_setting_lookup_bool(setting, ui_strings.beep_on_filetrans_accept, &s->beep_on_filetrans_accept)) { - s->beep_on_filetrans_accept = s->beep_on_filetrans_accept ? NT_BEEP : 0; + if (config_setting_lookup_bool(setting, ui_strings.bell_on_filetrans_accept, &s->bell_on_filetrans_accept)) { + s->bell_on_filetrans_accept = s->bell_on_filetrans_accept ? NT_BEEP : 0; } - if (config_setting_lookup_bool(setting, ui_strings.beep_on_invite, &s->beep_on_invite)) { - s->beep_on_invite = s->beep_on_invite ? NT_BEEP : 0; + if (config_setting_lookup_bool(setting, ui_strings.bell_on_invite, &s->bell_on_invite)) { + s->bell_on_invite = s->bell_on_invite ? NT_BEEP : 0; } config_setting_lookup_bool(setting, ui_strings.autolog, &s->autolog); diff --git a/src/settings.h b/src/settings.h index d39203f..a195ad0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -38,10 +38,10 @@ struct user_settings { int alerts; /* boolean */ /* boolean (is set to NT_BEEP or 0 after loading) */ - int beep_on_message; - int beep_on_filetrans; - int beep_on_filetrans_accept; - int beep_on_invite; + int bell_on_message; + int bell_on_filetrans; + int bell_on_filetrans_accept; + int bell_on_invite; int timestamps; /* boolean */ char timestamp_format[TIME_STR_SIZE];