From c9a6e10c2621a5df3285c881fa98eb00707fc6ad Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 14 Feb 2015 16:20:15 +0000 Subject: [PATCH] Use single quotes for terminal notifier notifications to avoid variable expansion --- src/ui/notifier.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ui/notifier.c b/src/ui/notifier.c index 693817d6..e8bc61e3 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -243,10 +243,9 @@ _notify(const char * const message, int timeout, Shell_NotifyIcon(NIM_MODIFY, &nid); #endif #ifdef HAVE_OSXNOTIFY - GString *notify_command = g_string_new("terminal-notifier -title \"Profanity\" -message \""); + GString *notify_command = g_string_new("terminal-notifier -title \"Profanity\" -message '"); - char *escaped_double = str_replace(message, "\"", "\\\""); - char *escaped_single = str_replace(escaped_double, "`", "\\`"); + char *escaped_single = str_replace(message, "'", "'\\''"); if (escaped_single[0] == '<') { g_string_append(notify_command, "\\<"); @@ -264,8 +263,7 @@ _notify(const char * const message, int timeout, g_string_append(notify_command, escaped_single); } - g_string_append(notify_command, "\""); - free(escaped_double); + g_string_append(notify_command, "'"); free(escaped_single); char *term_name = getenv("TERM_PROGRAM"); @@ -288,4 +286,4 @@ _notify(const char * const message, int timeout, g_string_free(notify_command, TRUE); #endif -} \ No newline at end of file +}