diff options
author | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2023-04-03 18:37:23 +0200 |
---|---|---|
committer | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2023-04-08 18:38:36 +0200 |
commit | 0cf79848e90289eba34af5b89aafdc9fc8930383 (patch) | |
tree | 9a46dd0cb40bef1a4f993941d058bc580bc1741b /src/command | |
parent | 5f078f95f2b0d77f1f94fbe69aaa0b6ae605b398 (diff) | |
download | profani-tty-0cf79848e90289eba34af5b89aafdc9fc8930383.tar.gz |
add `/statusbar tabmode actlist`
The existing way how active tabs are displayed didn't allow showing more than 10 tabs. This patch adds a mode where the statusbar shows a comma-separated list of tabs which were active since the last time viewed. This view is inspired by how `irssi` shows the active tabs, therefore it is also called `actlist`. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_ac.c | 13 | ||||
-rw-r--r-- | src/command/cmd_defs.c | 3 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 15 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 0cc4a170..bb204935 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -265,6 +265,7 @@ static Autocomplete statusbar_self_ac; static Autocomplete statusbar_chat_ac; static Autocomplete statusbar_room_ac; static Autocomplete statusbar_show_ac; +static Autocomplete statusbar_tabmode_ac; static Autocomplete clear_ac; static Autocomplete invite_ac; static Autocomplete status_ac; @@ -1030,6 +1031,7 @@ cmd_ac_init(void) autocomplete_add(statusbar_ac, "hide"); autocomplete_add(statusbar_ac, "maxtabs"); autocomplete_add(statusbar_ac, "tablen"); + autocomplete_add(statusbar_ac, "tabmode"); autocomplete_add(statusbar_ac, "self"); autocomplete_add(statusbar_ac, "chat"); autocomplete_add(statusbar_ac, "room"); @@ -1058,6 +1060,10 @@ cmd_ac_init(void) autocomplete_add(statusbar_show_ac, "number"); autocomplete_add(statusbar_show_ac, "read"); + statusbar_tabmode_ac = autocomplete_new(); + autocomplete_add(statusbar_tabmode_ac, "actlist"); + autocomplete_add(statusbar_tabmode_ac, "default"); + status_ac = autocomplete_new(); autocomplete_add(status_ac, "set"); autocomplete_add(status_ac, "get"); @@ -1678,6 +1684,7 @@ cmd_ac_reset(ProfWin* window) autocomplete_reset(statusbar_chat_ac); autocomplete_reset(statusbar_room_ac); autocomplete_reset(statusbar_show_ac); + autocomplete_reset(statusbar_tabmode_ac); autocomplete_reset(clear_ac); autocomplete_reset(invite_ac); autocomplete_reset(status_ac); @@ -1864,6 +1871,7 @@ cmd_ac_uninit(void) autocomplete_free(statusbar_chat_ac); autocomplete_free(statusbar_room_ac); autocomplete_free(statusbar_show_ac); + autocomplete_free(statusbar_tabmode_ac); autocomplete_free(clear_ac); autocomplete_free(invite_ac); autocomplete_free(status_ac); @@ -4110,6 +4118,11 @@ _statusbar_autocomplete(ProfWin* window, const char* const input, gboolean previ return found; } + found = autocomplete_param_with_ac(input, "/statusbar tabmode", statusbar_tabmode_ac, TRUE, previous); + if (found) { + return found; + } + found = autocomplete_param_with_ac(input, "/statusbar room", statusbar_room_ac, TRUE, previous); return found; diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index d204db3b..fd90fdca 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -1293,6 +1293,7 @@ static const struct cmd_t command_defs[] = { "/statusbar hide name|number|read", "/statusbar maxtabs <value>", "/statusbar tablen <value>", + "/statusbar tabmode default|actlist", "/statusbar self user|barejid|fulljid|off", "/statusbar chat user|jid", "/statusbar room room|jid", @@ -1303,6 +1304,7 @@ static const struct cmd_t command_defs[] = { CMD_ARGS( { "maxtabs <value>", "Set the maximum number of tabs to display, <value> must be between 0 and 10." }, { "tablen <value>", "Set the maximum number of characters to show as the tab name, 0 sets to unlimited." }, + { "tabmode default|actlist", "Set the mode how the 'active tabs' are shown." }, { "show|hide name", "Show or hide names in tabs." }, { "show|hide number", "Show or hide numbers in tabs." }, { "show|hide read", "Show or hide inactive tabs." }, @@ -1315,6 +1317,7 @@ static const struct cmd_t command_defs[] = { CMD_EXAMPLES( "/statusbar maxtabs 8", "/statusbar tablen 5", + "/statusbar tabmode actlist", "/statusbar self user", "/statusbar chat jid", "/statusbar hide read", diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 919b7ddb..9dcd4f3d 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -6341,6 +6341,21 @@ cmd_statusbar(ProfWin* window, const char* const command, gchar** args) } } + if (g_strcmp0(args[0], "tabmode") == 0) { + char* tabmode = NULL; + if ((g_strcmp0(args[1], "default") == 0) || (g_strcmp0(args[1], "actlist") == 0)) { + tabmode = args[1]; + } + if (tabmode == NULL) { + cons_bad_cmd_usage(command); + return TRUE; + } + prefs_set_string(PREF_STATUSBAR_TABMODE, tabmode); + cons_show("Using \"%s\" tabmode for statusbar.", tabmode); + ui_resize(); + return TRUE; + } + if (g_strcmp0(args[0], "self") == 0) { if (g_strcmp0(args[1], "barejid") == 0) { prefs_set_string(PREF_STATUSBAR_SELF, "barejid"); |