aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2021-06-25 12:57:45 +0200
committerWolfgang Müller2021-06-25 14:29:24 +0200
commitb497a49d8bd2a345dd30a9f55dc4976560df157f (patch)
treec902cccc80d2e6b1bfcd1af3ac81d8bde82f695f
parentdd61a832468c958ad81acf2d216bf0e7efefa99f (diff)
downloadweltschmerz-b497a49d8bd2a345dd30a9f55dc4976560df157f.tar.gz
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.
-rw-r--r--terminal.vala4
1 files changed, 4 insertions, 0 deletions
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);
}
}