From b497a49d8bd2a345dd30a9f55dc4976560df157f Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Fri, 25 Jun 2021 12:57:45 +0200 Subject: Copy URLs to the PRIMARY selection as well Currently, weltschmerz only copies URLs to GTK's default clipboard. This is defined to be CLIPBOARD, leaving the PRIMARY selection unchanged. Since all other normal copy/paste operations start with making a selection and therefore set PRIMARY, make sure to also set the PRIMARY selection when copying a URL. This brings weltschmerz in line with how other GTK apps behave. --- terminal.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terminal.vala b/terminal.vala index bb2083f..4a2e676 100644 --- a/terminal.vala +++ b/terminal.vala @@ -34,6 +34,7 @@ class Terminal : Gtk.Overlay { [GtkChild] unowned Gtk.SearchEntry search_entry; [GtkChild] unowned Vte.Terminal vte; Gtk.Clipboard clipboard; + Gtk.Clipboard primary; Gtk.Settings settings; bool has_search; @@ -65,6 +66,7 @@ class Terminal : Gtk.Overlay { standard_context_menu.attach_to_widget(vte, null); clipboard = Gtk.Clipboard.get_default(window.get_display()); + primary = Gtk.Clipboard.get_for_display(window.get_display(), Gdk.SELECTION_PRIMARY); copy_item_text.activate.connect(() => vte_copy()); copy_item_html.activate.connect(() => vte_copy(true)); @@ -308,8 +310,10 @@ class Terminal : Gtk.Overlay { void uri_copy() { if (url_match != null) { clipboard.set_text(url_match, -1); + primary.set_text(url_match, -1); } else if (hyperlink_match != null) { clipboard.set_text(hyperlink_match, -1); + primary.set_text(hyperlink_match, -1); } } -- cgit v1.2.3-2-gb3c3