GNOME Bugzilla – Bug 786935
Support copying URLs without using right-click menu
Last modified: 2021-06-10 21:17:35 UTC
Earlier versions of gnome-terminal used to select most URLs (including protocol) by double-clicking parts of URL (not always, not perfect, etc.) even though it never was intended to select full URLs. This could be used with ctrl+shift+c to copy the URL quickly (a lot faster than right-click menu for me). This "regression" got filed in Ubuntu here: https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1501250 Ctrl+click, which will open the URL in the browser, could be used as a workaround in some cases. Howver, this requires going to the browser workspace, ctrl+l (location bar), ctrl+c to copy the link. If the link you're selecting is a download link it doesn't work at all since you'd have to esc out of saving location, which closes the tab (in Chromium), so you can't get to the link from the browser at all. Egmont suggested I filed an upstream bug to get the maintainer's opinion: https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1501250/comments/15 Long story short, is it feasible to add ctrl+shift+click as a shortlink to copy the URL to the clipboard? I would be very happy with that as a solution since it doesn't require me using the right-click menu or abusing double-clicking words as URL selection.
FWIW I think the feature would be discoverable if "Copy Link Address" in the right-click menu would show (Shift+Ctrl+<click>) next to it, though that does make the menu wider overall.
Created attachment 358629 [details] [review] Fix Here's the first version. I'm not sure whether to copy to the clipboard or the primary selection, but since you mentioned Ctrl+Shift+C as part of your workflow, I went with the clipboard. Also unsure about the grab_focus() call (or lack thereof) copied from the match_clicked_cb method. match_clicked should be renamed to match_open.
I think this being a shortcut for the existing "Copy Link Address" is sensible unless you want another branch in behavior. If they're equivalent you can put Shift+Ctrl+<click> next to the right-click menu entry for discoverability. This definitely matches my workflow, so I'm happy, but I've never really used primary selection, so I can't tell whether it makes sense over the other option. Maybe that's another way to see the downstream-reported "regression", that there's no good way to copy to primary selection if you can't easily select URLs.
I believe a case could be made that double clicking should not select punctuation at the end of a "word", but it *should* select it at the beginning of a word. Therefore, if ":" and "/" (and others) are in the set of "word characters", double clicking a URL will work properly and so will selecting a filepath. Also, double clicking a grep output name (ending with ":") will not select the colon. This seems to be to be a nice compromise. I agree with the sentiment that the right click menu is cumbersome. Double clicking is so much handier. The menu is for exceptional cases, not everyday cases and double clicking a URL or a filepath is a many, many times a day occurrance for many of us.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7764.