From 93775267fc87a0f4137d9f9fad6034c7973ebfcf Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 12 Sep 2017 10:40:52 +0200 Subject: [PATCH] Display notification after copying image Signed-off-by: Sebastian Ramacher --- zathura/callbacks.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/zathura/callbacks.c b/zathura/callbacks.c index 1d176c5..7db22f8 100644 --- a/zathura/callbacks.c +++ b/zathura/callbacks.c @@ -611,9 +611,23 @@ cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf, void* data) if (selection != NULL) { gtk_clipboard_set_image(gtk_clipboard_get(*selection), pixbuf); - } - g_free(selection); + bool notification = true; + girara_setting_get(zathura->ui.session, "selection-notification", ¬ification); + + if (notification == true) { + char* target = NULL; + girara_setting_get(zathura->ui.session, "selection-clipboard", &target); + + char* escaped_text = g_markup_printf_escaped( + _("Copied selected image to selection %s"), target); + g_free(target); + + girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text); + } + + g_free(selection); + } } void