mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge remote-tracking branch 'incertia/exit-title'
Conflicts: src/command/command.c src/config/preferences.c src/config/preferences.h
This commit is contained in:
commit
0d0ed9b7ca
@ -11,3 +11,4 @@
|
|||||||
- Additional readline style shortcuts
|
- Additional readline style shortcuts
|
||||||
- Improved chat session handling
|
- Improved chat session handling
|
||||||
- Override resource during chat and resource display settings (/resource)
|
- Override resource during chat and resource display settings (/resource)
|
||||||
|
- Disable terminal title by default, additonal title on exit
|
||||||
|
@ -723,10 +723,12 @@ static struct cmd_t command_defs[] =
|
|||||||
|
|
||||||
{ "/titlebar",
|
{ "/titlebar",
|
||||||
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
|
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
|
||||||
{ "/titlebar show on|off", "Show information in the window title bar.",
|
{ "/titlebar show|goodbye on|off", "Manage the terminal window title.",
|
||||||
{ "/titlebar show on|off",
|
{ "/titlebar show|goodbye on|off",
|
||||||
"---------------------",
|
"---------------------",
|
||||||
"Show information in the window title bar.",
|
"Show or hide a title and exit message in the terminal window title.",
|
||||||
|
"show - Show current logged in user, and unread messages in the title.",
|
||||||
|
"goodbye - Show a message in the title when exiting profanity.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/mouse",
|
{ "/mouse",
|
||||||
@ -1208,6 +1210,7 @@ cmd_init(void)
|
|||||||
|
|
||||||
titlebar_ac = autocomplete_new();
|
titlebar_ac = autocomplete_new();
|
||||||
autocomplete_add(titlebar_ac, "show");
|
autocomplete_add(titlebar_ac, "show");
|
||||||
|
autocomplete_add(titlebar_ac, "goodbye");
|
||||||
|
|
||||||
log_ac = autocomplete_new();
|
log_ac = autocomplete_new();
|
||||||
autocomplete_add(log_ac, "maxsize");
|
autocomplete_add(log_ac, "maxsize");
|
||||||
@ -2497,6 +2500,11 @@ _titlebar_autocomplete(char *input, int *size)
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
found = autocomplete_param_with_func(input, size, "/titlebar goodbye", prefs_autocomplete_boolean_choice);
|
||||||
|
if (found != NULL) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
found = autocomplete_param_with_ac(input, size, "/titlebar", titlebar_ac, FALSE);
|
found = autocomplete_param_with_ac(input, size, "/titlebar", titlebar_ac, FALSE);
|
||||||
if (found != NULL) {
|
if (found != NULL) {
|
||||||
return found;
|
return found;
|
||||||
|
@ -3252,14 +3252,18 @@ cmd_states(gchar **args, struct cmd_help_t help)
|
|||||||
gboolean
|
gboolean
|
||||||
cmd_titlebar(gchar **args, struct cmd_help_t help)
|
cmd_titlebar(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
if (g_strcmp0(args[0], "show") != 0) {
|
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (g_strcmp0(args[1], "off") == 0) {
|
if (g_strcmp0(args[0], "show") == 0 && g_strcmp0(args[1], "off") == 0) {
|
||||||
ui_clear_win_title();
|
ui_clear_win_title();
|
||||||
}
|
}
|
||||||
return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
|
if (g_strcmp0(args[0], "show") == 0) {
|
||||||
|
return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
|
||||||
|
} else {
|
||||||
|
return _cmd_set_boolean_preference(args[1], help, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -140,4 +140,4 @@ gboolean cmd_inpblock(gchar **args, struct cmd_help_t help);
|
|||||||
|
|
||||||
gboolean cmd_form_field(char *tag, gchar **args);
|
gboolean cmd_form_field(char *tag, gchar **args);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -511,6 +511,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_THEME:
|
case PREF_THEME:
|
||||||
case PREF_VERCHECK:
|
case PREF_VERCHECK:
|
||||||
case PREF_TITLEBAR_SHOW:
|
case PREF_TITLEBAR_SHOW:
|
||||||
|
case PREF_TITLEBAR_GOODBYE:
|
||||||
case PREF_FLASH:
|
case PREF_FLASH:
|
||||||
case PREF_INTYPE:
|
case PREF_INTYPE:
|
||||||
case PREF_HISTORY:
|
case PREF_HISTORY:
|
||||||
@ -583,6 +584,8 @@ _get_key(preference_t pref)
|
|||||||
return "vercheck";
|
return "vercheck";
|
||||||
case PREF_TITLEBAR_SHOW:
|
case PREF_TITLEBAR_SHOW:
|
||||||
return "titlebar.show";
|
return "titlebar.show";
|
||||||
|
case PREF_TITLEBAR_GOODBYE:
|
||||||
|
return "titlebar.goodbye";
|
||||||
case PREF_FLASH:
|
case PREF_FLASH:
|
||||||
return "flash";
|
return "flash";
|
||||||
case PREF_INTYPE:
|
case PREF_INTYPE:
|
||||||
|
@ -55,6 +55,7 @@ typedef enum {
|
|||||||
PREF_VERCHECK,
|
PREF_VERCHECK,
|
||||||
PREF_THEME,
|
PREF_THEME,
|
||||||
PREF_TITLEBAR_SHOW,
|
PREF_TITLEBAR_SHOW,
|
||||||
|
PREF_TITLEBAR_GOODBYE,
|
||||||
PREF_FLASH,
|
PREF_FLASH,
|
||||||
PREF_INTYPE,
|
PREF_INTYPE,
|
||||||
PREF_HISTORY,
|
PREF_HISTORY,
|
||||||
|
@ -292,7 +292,13 @@ _init(const int disable_tls, char *log_level)
|
|||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
ui_clear_win_title();
|
if (prefs_get_boolean(PREF_TITLEBAR_SHOW)) {
|
||||||
|
if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
|
||||||
|
ui_goodbye_title();
|
||||||
|
} else {
|
||||||
|
ui_clear_win_title();
|
||||||
|
}
|
||||||
|
}
|
||||||
ui_close_all_wins();
|
ui_close_all_wins();
|
||||||
jabber_disconnect();
|
jabber_disconnect();
|
||||||
jabber_shutdown();
|
jabber_shutdown();
|
||||||
|
@ -969,6 +969,11 @@ cons_titlebar_setting(void)
|
|||||||
} else {
|
} else {
|
||||||
cons_show("Titlebar show (/titlebar) : OFF");
|
cons_show("Titlebar show (/titlebar) : OFF");
|
||||||
}
|
}
|
||||||
|
if (prefs_get_boolean(PREF_TITLEBAR_GOODBYE)) {
|
||||||
|
cons_show("Titlebar goodbye (/titlebar) : ON");
|
||||||
|
} else {
|
||||||
|
cons_show("Titlebar goodbye (/titlebar) : OFF");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2301,6 +2301,13 @@ ui_clear_win_title(void)
|
|||||||
printf("%c]0;%c", '\033', '\007');
|
printf("%c]0;%c", '\033', '\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_goodbye_title(void)
|
||||||
|
{
|
||||||
|
int result = system("/bin/echo -ne \"\033]0;Thanks for using Profanity\007\"");
|
||||||
|
if(result == -1) log_error("Error printing title on shutdown");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_statusbar_new(const int win)
|
ui_statusbar_new(const int win)
|
||||||
{
|
{
|
||||||
|
@ -191,6 +191,7 @@ void ui_handle_recipient_not_found(const char * const recipient, const char * co
|
|||||||
void ui_handle_recipient_error(const char * const recipient, const char * const err_msg);
|
void ui_handle_recipient_error(const char * const recipient, const char * const err_msg);
|
||||||
void ui_handle_error(const char * const err_msg);
|
void ui_handle_error(const char * const err_msg);
|
||||||
void ui_clear_win_title(void);
|
void ui_clear_win_title(void);
|
||||||
|
void ui_goodbye_title(void);
|
||||||
void ui_handle_room_join_error(const char * const roomjid, const char * const err);
|
void ui_handle_room_join_error(const char * const roomjid, const char * const err);
|
||||||
void ui_handle_room_configuration(const char * const roomjid, DataForm *form);
|
void ui_handle_room_configuration(const char * const roomjid, DataForm *form);
|
||||||
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message);
|
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message);
|
||||||
|
@ -284,6 +284,7 @@ void ui_handle_error(const char * const err_msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ui_clear_win_title(void) {}
|
void ui_clear_win_title(void) {}
|
||||||
|
void ui_goodbye_title(void) {}
|
||||||
void ui_handle_room_join_error(const char * const roomjid, const char * const err) {}
|
void ui_handle_room_join_error(const char * const roomjid, const char * const err) {}
|
||||||
void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {}
|
void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {}
|
||||||
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {}
|
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user