diff --git a/meson.build b/meson.build index 851dfb6..514e9e7 100644 --- a/meson.build +++ b/meson.build @@ -91,7 +91,7 @@ test_mconn_utils = executable('test-mconn-utils', test_mconn_utils_src, dependencies: [ glib_dep, gobject_dep, gio_dep, gio_unix_dep, - posix_dep, + posix_dep, libnotify_dep, ], install: false) test('mconn-utils', test_mconn_utils) diff --git a/src/mconnect/share.vala b/src/mconnect/share.vala index 13684c2..c3c1473 100644 --- a/src/mconnect/share.vala +++ b/src/mconnect/share.vala @@ -101,6 +101,8 @@ class ShareHandler : Object, PacketHandlerInterface { if (urls.length > 0) { var url = urls[0]; debug("got URL: %s, launching...", url); + Utils.show_own_notification("Launching shared URL", + dev.device_name); AppInfo.launch_default_for_uri(url, null); } } @@ -112,6 +114,8 @@ class ShareHandler : Object, PacketHandlerInterface { if (display != null) { var cb = Gtk.Clipboard.get_default(display); cb.set_text(text, -1); + Utils.show_own_notification("Text copied to clipboard", + dev.device_name); } } } \ No newline at end of file diff --git a/src/mconnect/utils.vala b/src/mconnect/utils.vala index 5c41557..69512b8 100644 --- a/src/mconnect/utils.vala +++ b/src/mconnect/utils.vala @@ -186,4 +186,16 @@ using Posix; return null; } } + + public void show_own_notification(string message, + string summary = "mconnect", + string icon = "dialog-information") { + try { + var notif = new Notify.Notification(summary, message, + "phone"); + notif.show(); + } catch (Error e) { + critical("failed to show notification: %s", e.message); + } + } } \ No newline at end of file