summaryrefslogtreecommitdiff
path: root/src
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
parentbfa9cd30e731fbfa59b7ece5704bd47754337b8d (diff)
add xterm 777 notification support. Closes T1765
Diffstat (limited to 'src')
-rw-r--r--src/bin/dbus.c5
-rw-r--r--src/bin/termptyesc.c52
2 files changed, 57 insertions, 0 deletions
diff --git a/src/bin/dbus.c b/src/bin/dbus.c
index b7d255c..da24108 100644
--- a/src/bin/dbus.c
+++ b/src/bin/dbus.c
@@ -82,6 +82,11 @@ ty_dbus_init(void)
82 82
83 eldbus_init(); 83 eldbus_init();
84 84
85 if (!elm_need_sys_notify())
86 {
87 WRN("no elementary system notification support");
88 }
89
85 ty_dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); 90 ty_dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
86 ty_e_object = eldbus_object_get(ty_dbus_conn, 91 ty_e_object = eldbus_object_get(ty_dbus_conn,
87 "org.enlightenment.wm.service", 92 "org.enlightenment.wm.service",
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:
1140} 1140}
1141 1141
1142 1142
1143static void
1144_handle_xterm_777_command(Termpty *ty EINA_UNUSED,
1145 char *s, int len EINA_UNUSED)
1146{
1147#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR >= 8)
1148 char *cmd_end = NULL,
1149 *title = NULL,
1150 *title_end = NULL,
1151 *message = NULL;
1152
1153 if (strncmp(s, "notify;", strlen("notify;")))
1154 {
1155 ERR("unrecognized xterm 777 command %s", s);
1156 return;
1157 }
1158
1159 if (!elm_need_sys_notify())
1160 {
1161 ERR("no elementary system notification support");
1162 return;
1163 }
1164 cmd_end = s + strlen("notify");
1165 if (*cmd_end != ';')
1166 return;
1167 *cmd_end = '\0';
1168 title = cmd_end + 1;
1169 title_end = strchr(title, ';');
1170 if (!title_end)
1171 {
1172 *cmd_end = ';';
1173 return;
1174 }
1175 *title_end = '\0';
1176 message = title_end + 1;
1177
1178 elm_sys_notify_send(0, "dialog-information", title, message,
1179 ELM_SYS_NOTIFY_URGENCY_NORMAL, -1,
1180 NULL, NULL);
1181 *cmd_end = ';';
1182 *title_end = ';';
1183#endif
1184}
1185
1143static int 1186static int
1144_handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) 1187_handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1145{ 1188{
@@ -1306,6 +1349,15 @@ _handle_esc_xterm(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1306 r, g, b, 0xff); 1349 r, g, b, 0xff);
1307 } 1350 }
1308 break; 1351 break;
1352 case 777:
1353 DBG("xterm notification support");
1354 s = eina_unicode_unicode_to_utf8(p, &len);
1355 if (s)
1356 {
1357 _handle_xterm_777_command(ty, s, len);
1358 free(s);
1359 }
1360 break;
1309 default: 1361 default:
1310 // many others 1362 // many others
1311 ERR("unhandled xterm esc %d", arg); 1363 ERR("unhandled xterm esc %d", arg);