about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-01-12 01:12:42 +0000
committerJames Booth <boothj5@gmail.com>2015-01-12 01:12:42 +0000
commit0d0ed9b7ca4b9055fece7ddc4e2430b900cbb355 (patch)
treee25b30c13981503ac96b85f6514a40eab98279b1 /src/command
parentc64484c6ed8ab38b840786d76e986cf622d56ece (diff)
parent22cc641905fcb6f321653a2826ef588d4cece223 (diff)
downloadprofani-tty-0d0ed9b7ca4b9055fece7ddc4e2430b900cbb355.tar.gz
Merge remote-tracking branch 'incertia/exit-title'
Conflicts:
	src/command/command.c
	src/config/preferences.c
	src/config/preferences.h
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c14
-rw-r--r--src/command/commands.c10
-rw-r--r--src/command/commands.h2
3 files changed, 19 insertions, 7 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 64bf09d7..f2ceaa82 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -723,10 +723,12 @@ static struct cmd_t command_defs[] =
 
     { "/titlebar",
         cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
-        { "/titlebar show on|off", "Show information in the window title bar.",
-        { "/titlebar show on|off",
+        { "/titlebar show|goodbye on|off", "Manage the terminal window title.",
+        { "/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  } } },
 
     { "/mouse",
@@ -1208,6 +1210,7 @@ cmd_init(void)
 
     titlebar_ac = autocomplete_new();
     autocomplete_add(titlebar_ac, "show");
+    autocomplete_add(titlebar_ac, "goodbye");
 
     log_ac = autocomplete_new();
     autocomplete_add(log_ac, "maxsize");
@@ -2497,6 +2500,11 @@ _titlebar_autocomplete(char *input, int *size)
         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);
     if (found != NULL) {
         return found;
diff --git a/src/command/commands.c b/src/command/commands.c
index f72a6047..fba32b8b 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -3252,14 +3252,18 @@ cmd_states(gchar **args, struct cmd_help_t help)
 gboolean
 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);
         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();
     }
-    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
diff --git a/src/command/commands.h b/src/command/commands.h
index dd09fae0..f4e040a9 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -140,4 +140,4 @@ gboolean cmd_inpblock(gchar **args, struct cmd_help_t help);
 
 gboolean cmd_form_field(char *tag, gchar **args);
 
-#endif
\ No newline at end of file
+#endif