diff options
author | Michael Vetter <jubalh@iodoru.org> | 2023-04-08 18:50:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-08 18:50:50 +0200 |
commit | ac581c29bfa7c31fbfb6fe8019d257d3883b33bb (patch) | |
tree | 9a46dd0cb40bef1a4f993941d058bc580bc1741b /src/command | |
parent | 5f078f95f2b0d77f1f94fbe69aaa0b6ae605b398 (diff) | |
parent | 0cf79848e90289eba34af5b89aafdc9fc8930383 (diff) | |
download | profani-tty-ac581c29bfa7c31fbfb6fe8019d257d3883b33bb.tar.gz |
Merge pull request #1813 from profanity-im/tabmode-irssi
add `/statusbar tabmode actlist`
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"); |