1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-25 19:03:02 +01:00

Add further explanation to the beep_on* options

This also renames beep_on* to bell_on*.
This commit is contained in:
Marvin Ewald 2016-07-21 11:25:40 +02:00
parent 9aedcf7753
commit 5b1b420ac0
7 changed files with 87 additions and 78 deletions

View File

@ -85,27 +85,7 @@ Time format string for logging enclosed by double quotes\&. See
.PP .PP
\fBalerts\fR \fBalerts\fR
.RS 4 .RS 4
Enable or disable terminal alerts on events\&. true or false Enable or disable acoustic 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
.RE .RE
.PP .PP
\fBnative_colors\fR \fBnative_colors\fR
@ -172,6 +152,30 @@ Set user status when attaching and detaching from GNU screen or tmux\&. true or
.RS 4 .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\&. 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 .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 .RE
.PP .PP
\fBaudio\fR \fBaudio\fR

View File

@ -55,19 +55,7 @@ OPTIONS
See *date*(1) See *date*(1)
*alerts*;; *alerts*;;
Enable or disable terminal alerts on events. true or false Enable or disable acoustic 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
*native_colors*;; *native_colors*;;
Select between native terminal colors and toxic color theme. true or false 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 detach. When attaching, the status message is set back to the original
value. 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*:: *audio*::
Configuration related to audio devices. Configuration related to audio devices.

View File

@ -5,20 +5,20 @@ ui = {
// true to enable timestamps, false to disable // true to enable timestamps, false to disable
timestamps=true; timestamps=true;
// true to enable terminal alerts on messages, false to disable // true to enable acoustic alerts on messages, false to disable
alerts=true; alerts=true;
// Beep when receiving a message // Output a bell when receiving a message (see manpage)
beep_on_message=true bell_on_message=true
// Beep when receiving a filetransfer // Output a bell when receiving a filetransfer (see manpage)
beep_on_filetrans=true bell_on_filetrans=true
// Don't beep when a filetransfer was accepted // Don't output a bell when a filetransfer was accepted (see manpage)
beep_on_filetrans_accept=false bell_on_filetrans_accept=false
// Beep when receiving a group/call invite // Output a bell when receiving a group/call invite (see manpage)
beep_on_invite=true bell_on_invite=true
// true to use native terminal colours, false to use toxic default colour theme // true to use native terminal colours, false to use toxic default colour theme
native_colors=false; native_colors=false;

View File

@ -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); write_to_log(msg, nick, ctx->log, false);
if (self->active_box != -1) 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); self->active_box, "%s", msg);
else 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); &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); write_to_log(action, nick, ctx->log, true);
if (self->active_box != -1) 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 ); self->active_box, "* %s %s", nick, action );
else 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 ); &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]; char progline[MAX_STR_SIZE];
init_progress_bar(progline); init_progress_bar(progline);
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", 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; ft->line_id = self->chatwin->hst->line_end->id + 2;
} else if (ft->state == FILE_TRANSFER_PAUSED) { /* transfer is resumed */ } else if (ft->state == FILE_TRANSFER_PAUSED) { /* transfer is resumed */
ft->state = FILE_TRANSFER_STARTED; 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); tox_file_get_file_id(m, friendnum, filenum, ft->file_id, NULL);
if (self->active_box != -1) 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 ); self->active_box, "Incoming file: %s", filename );
else 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 ); &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.length = length;
Friends.list[friendnumber].group_invite.type = type; 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]; char name[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, name, friendnumber); 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\""); line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Incoming audio call! Type: \"/answer\" or \"/reject\"");
if (self->ringing_sound == -1) 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) if (self->active_box != -1)
box_silent_notify2(self, NT_NOFOCUS | NT_WNDALERT_0, self->active_box, "Incoming audio call!"); box_silent_notify2(self, NT_NOFOCUS | NT_WNDALERT_0, self->active_box, "Incoming audio call!");

View File

@ -258,7 +258,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
/* Only play sound if mentioned by someone else */ /* Only play sound if mentioned by someone else */
if (strcasestr(msg, selfnick) && strcmp(selfnick, nick)) { 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) if (self->active_box != -1)
box_silent_notify2(self, NT_NOFOCUS, self->active_box, "%s %s", nick, msg); 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'; selfnick[n_len] = '\0';
if (strcasestr(action, selfnick)) { 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) if (self->active_box != -1)
box_silent_notify2(self, NT_NOFOCUS, self->active_box, "* %s %s", nick, action ); box_silent_notify2(self, NT_NOFOCUS, self->active_box, "* %s %s", nick, action );

View File

@ -51,10 +51,10 @@ static struct ui_strings {
const char* timestamp_format; const char* timestamp_format;
const char* log_timestamp_format; const char* log_timestamp_format;
const char* alerts; const char* alerts;
const char* beep_on_message; const char* bell_on_message;
const char* beep_on_filetrans; const char* bell_on_filetrans;
const char* beep_on_filetrans_accept; const char* bell_on_filetrans_accept;
const char* beep_on_invite; const char* bell_on_invite;
const char* native_colors; const char* native_colors;
const char* autolog; const char* autolog;
const char* history_size; const char* history_size;
@ -77,10 +77,10 @@ static struct ui_strings {
"timestamp_format", "timestamp_format",
"log_timestamp_format", "log_timestamp_format",
"alerts", "alerts",
"beep_on_message", "bell_on_message",
"beep_on_filetrans", "bell_on_filetrans",
"beep_on_filetrans_accept", "bell_on_filetrans_accept",
"beep_on_invite", "bell_on_invite",
"native_colors", "native_colors",
"autolog", "autolog",
"history_size", "history_size",
@ -104,10 +104,10 @@ static void ui_defaults(struct user_settings* settings)
settings->autolog = AUTOLOG_OFF; settings->autolog = AUTOLOG_OFF;
settings->alerts = ALERTS_ENABLED; settings->alerts = ALERTS_ENABLED;
settings->beep_on_message = 0; settings->bell_on_message = 0;
settings->beep_on_filetrans = 0; settings->bell_on_filetrans = 0;
settings->beep_on_filetrans_accept = 0; settings->bell_on_filetrans_accept = 0;
settings->beep_on_invite = 0; settings->bell_on_invite = 0;
settings->colour_theme = DFLT_COLS; settings->colour_theme = DFLT_COLS;
settings->history_size = 700; settings->history_size = 700;
settings->show_typing_self = SHOW_TYPING_ON; 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); 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)) { if (config_setting_lookup_bool(setting, ui_strings.bell_on_message, &s->bell_on_message)) {
s->beep_on_message = s->beep_on_message ? NT_BEEP : 0; 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)) { if (config_setting_lookup_bool(setting, ui_strings.bell_on_filetrans, &s->bell_on_filetrans)) {
s->beep_on_filetrans = s->beep_on_filetrans ? NT_BEEP : 0; 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)) { if (config_setting_lookup_bool(setting, ui_strings.bell_on_filetrans_accept, &s->bell_on_filetrans_accept)) {
s->beep_on_filetrans_accept = s->beep_on_filetrans_accept ? NT_BEEP : 0; 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)) { if (config_setting_lookup_bool(setting, ui_strings.bell_on_invite, &s->bell_on_invite)) {
s->beep_on_invite = s->beep_on_invite ? NT_BEEP : 0; s->bell_on_invite = s->bell_on_invite ? NT_BEEP : 0;
} }
config_setting_lookup_bool(setting, ui_strings.autolog, &s->autolog); config_setting_lookup_bool(setting, ui_strings.autolog, &s->autolog);

View File

@ -38,10 +38,10 @@ struct user_settings {
int alerts; /* boolean */ int alerts; /* boolean */
/* boolean (is set to NT_BEEP or 0 after loading) */ /* boolean (is set to NT_BEEP or 0 after loading) */
int beep_on_message; int bell_on_message;
int beep_on_filetrans; int bell_on_filetrans;
int beep_on_filetrans_accept; int bell_on_filetrans_accept;
int beep_on_invite; int bell_on_invite;
int timestamps; /* boolean */ int timestamps; /* boolean */
char timestamp_format[TIME_STR_SIZE]; char timestamp_format[TIME_STR_SIZE];