Commit 8f05b636 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add setting to hide notifications after text selection

parent 8e0514bc
......@@ -556,13 +556,18 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
if (selection != NULL) {
gtk_clipboard_set_text(gtk_clipboard_get(*selection), text, -1);
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' ');
char* escaped_text = g_markup_printf_escaped(
_("Copied selected text to clipboard: %s"), stripped_text);
g_free(stripped_text);
bool notification = true;
girara_setting_get(zathura->ui.session, "selection-notification", &notification);
girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text);
g_free(escaped_text);
if (notification == true) {
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' ');
char* escaped_text = g_markup_printf_escaped(
_("Copied selected text to clipboard: %s"), stripped_text);
g_free(stripped_text);
girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text);
g_free(escaped_text);
}
}
g_free(selection);
......
......@@ -229,6 +229,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service"), NULL, NULL);
string_value = "primary";
girara_setting_add(gsession, "selection-clipboard", string_value, STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "selection-notification", &bool_value, BOOLEAN, false, _("Enable notification after selecting text"), NULL, NULL);
#define DEFAULT_SHORTCUTS(mode) \
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \
......
......@@ -846,7 +846,7 @@ zoom-center
En/Disables horizontally centered zooming.
* Value type: Boolean
* Default value: False
* Default value: false
zoom-max
^^^^^^^^
......@@ -880,6 +880,13 @@ middle mouse button, or the Shift-Insert key combination.
* Value type: String
* Default value: primary
selection-notification
^^^^^^^^^^^^^^^^^^^^^^
Defines if a notification should be displayed after selecting text.
* Value type: Boolean
* Default value: true
synctex
^^^^^^^
En/Disables SyncTeX backward synchronization support.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment