aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyesc.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-01-12 23:11:12 +0100
committerBoris Faure <billiob@gmail.com>2015-01-12 23:13:43 +0100
commit87d653ea4d2718038e1094542072143cc9704a71 (patch)
tree2131cb898b4ba721a0ac124810731ed9f5c425b6 /src/bin/termptyesc.c
parentfix shadowed variable (diff)
downloadterminology-87d653ea4d2718038e1094542072143cc9704a71.tar.gz
add xterm 777 notification support. Closes https://phab.enlightenment.org/T1765
Diffstat (limited to 'src/bin/termptyesc.c')
-rw-r--r--src/bin/termptyesc.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 4cabcb5..58d2418 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1140,6 +1140,49 @@ err:
}
+static void
+_handle_xterm_777_command(Termpty *ty EINA_UNUSED,
+ char *s, int len EINA_UNUSED)
+{
+#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 8)
+ char *cmd_end = NULL,
+ *title = NULL,
+ *title_end = NULL,
+ *message = NULL;
+
+ if (strncmp(s, "notify;", strlen("notify;")))
+ {
+ ERR("unrecognized xterm 777 command %s", s);
+ return;
+ }
+
+ if (!elm_need_sys_notify())
+ {
+ ERR("no elementary system notification support");
+ return;
+ }
+ cmd_end = s + strlen("notify");
+ if (*cmd_end != ';')
+ return;
+ *cmd_end = '\0';
+ title = cmd_end + 1;
+ title_end = strchr(title, ';');
+ if (!title_end)
+ {
+ *cmd_end = ';';
+ return;
+ }
+ *title_end = '\0';
+ message = title_end + 1;
+
+ elm_sys_notify_send(0, "dialog-information", title, message,
+ ELM_SYS_NOTIFY_URGENCY_NORMAL, -1,
+ NULL, NULL);
+ *cmd_end = ';';
+ *title_end = ';';
+#endif
+}
+
static int
_handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
{
@@ -1306,6 +1349,15 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
r, g, b, 0xff);
}
break;
+ case 777:
+ DBG("xterm notification support");
+ s = eina_unicode_unicode_to_utf8(p, &len);
+ if (s)
+ {
+ _handle_xterm_777_command(ty, s, len);
+ free(s);
+ }
+ break;
default:
// many others
ERR("unhandled xterm esc %d", arg);