about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-31 01:48:52 +0000
committerJames Booth <boothj5@gmail.com>2014-12-31 01:48:52 +0000
commit032baa78a1a76b462c6ced02bbbbdf59c5d1336c (patch)
treeaf18abb88a76ce633c9f2de17babb7bec477df7d
parente7ddff61dcb0831d8f8ca469844c0de0306f8994 (diff)
downloadprofani-tty-032baa78a1a76b462c6ced02bbbbdf59c5d1336c.tar.gz
Use system command to print window title
-rw-r--r--src/ui/core.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 314810b1..2e69a96d 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -2274,21 +2274,23 @@ _ui_draw_term_title(void)
 
         if (unread != 0) {
             snprintf(new_win_title, sizeof(new_win_title),
-                "%c]0;%s (%d) - %s%c", '\033', "Profanity",
+                "echo -n \"%c]0;%s (%d) - %s%c\"", '\033', "Profanity",
                 unread, jid, '\007');
         } else {
             snprintf(new_win_title, sizeof(new_win_title),
-                "%c]0;%s - %s%c", '\033', "Profanity", jid,
+                "echo -n \"%c]0;%s - %s%c\"", '\033', "Profanity", jid,
                 '\007');
         }
     } else {
-        snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%c", '\033',
+        snprintf(new_win_title, sizeof(new_win_title), "echo -n \"%c]0;%s%c\"", '\033',
             "Profanity", '\007');
     }
-
     if (g_strcmp0(win_title, new_win_title) != 0) {
         // print to x-window title bar
-        printf("%s", new_win_title);
+        int res = system(new_win_title);
+        if (res == -1) {
+            log_error("Error printing title");
+        }
         if (win_title != NULL) {
             free(win_title);
         }