mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 16:56:01 +01:00
Print target selection
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
50ec6192be
commit
5780a99291
2 changed files with 10 additions and 2 deletions
|
@ -580,9 +580,13 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
|
||||||
girara_setting_get(zathura->ui.session, "selection-notification", ¬ification);
|
girara_setting_get(zathura->ui.session, "selection-notification", ¬ification);
|
||||||
|
|
||||||
if (notification == true) {
|
if (notification == true) {
|
||||||
|
char* target = NULL;
|
||||||
|
girara_setting_get(zathura->ui.session, "selection-clipboard", &target);
|
||||||
|
|
||||||
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' ');
|
char* stripped_text = g_strdelimit(g_strdup(text), "\n\t\r\n", ' ');
|
||||||
char* escaped_text = g_markup_printf_escaped(
|
char* escaped_text = g_markup_printf_escaped(
|
||||||
_("Copied selected text to clipboard: %s"), stripped_text);
|
_("Copied selected text to selection %s: %s"), target, stripped_text);
|
||||||
|
g_free(target);
|
||||||
g_free(stripped_text);
|
g_free(stripped_text);
|
||||||
|
|
||||||
girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text);
|
girara_notify(zathura->ui.session, GIRARA_INFO, "%s", escaped_text);
|
||||||
|
|
|
@ -229,11 +229,15 @@ GdkAtom* get_selection(zathura_t* zathura)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(zathura != NULL, NULL);
|
g_return_val_if_fail(zathura != NULL, NULL);
|
||||||
|
|
||||||
char* value;
|
char* value = NULL;
|
||||||
girara_setting_get(zathura->ui.session, "selection-clipboard", &value);
|
girara_setting_get(zathura->ui.session, "selection-clipboard", &value);
|
||||||
|
if (value == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
GdkAtom* selection = g_try_malloc(sizeof(GdkAtom));
|
GdkAtom* selection = g_try_malloc(sizeof(GdkAtom));
|
||||||
if (selection == NULL) {
|
if (selection == NULL) {
|
||||||
|
g_free(selection);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue