Double clicking on a word in gnome terminal selects the whole word. Unfortunately, this selection doesn't include colons such that URLs aren't completely selected, e.g. with
http://foo.example.org/
only
//foo.example.org/
is selected.
How do I configure this selection behavior such that complete URLs are selected?
See also:
- How to configure the double click behavior in an X terminal? - the described resources aren't interpreted by Gnome Terminal
- gnome classic terminal mouse double click selection - the Gnome Shell Terminal profile preference dialog doesn't have this option, anymore
1 Answer 1
How much is selected on double click can be configured via adding additional character classes to the default set. That means that adding a colon and other special characters that may show up in URLs leads to double click also selecting complete URLs.
This can be configured via the gnome config database. For that one has to get the id of the gnome shell profile. To get the default one:
puuid=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d "'")
Adding some URL related characters:
gsettings set \
org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$puuid/ \
word-char-exceptions '@ms "-=&#:/.?@+~_%;"'
Note that:
@ms
denotes the maybe-string gvariant type- the character class syntax matches the regex one, i.e.
a-z
specifies a range, where-az
specified the literal 3 characters. Thus, I have explicitly put the-
in the first position
History: In classic Gnome Terminal versions, the profile preference dialog contained a field for configuring those additional characters. With Gnome 3, UI experts have removed this option from the dialog because they thought it was too complicated to use, though. The default was also changed after Fedora 21.
-
13"experts" should be in quotes. :>jhermann– jhermann2016年06月20日 14:41:55 +00:00Commented Jun 20, 2016 at 14:41
-
1If this doesn’t work (
echo $pid
is empty), try:pid=$(dconf list /org/gnome/terminal/legacy/profiles:/ | tr -d ":/")
rumpel– rumpel2018年01月19日 12:43:30 +00:00Commented Jan 19, 2018 at 12:43 -
@rumpel, hm, the above
dconf read ...
still works for me on Fedora 26. Your list command returns all profile ids and other entries in that directory. Thus, you'll likely end up with a malformed write command if you use that command substitution.maxschlepzig– maxschlepzig2018年01月19日 21:17:29 +00:00Commented Jan 19, 2018 at 21:17 -
1@rumpel, I've updated the answer. Obtaining the default profile with
dconf
only works if you have more than one profile configured and/or have changed the default profile setting. Otherwise, the command returns nothing. Thegsettings
command is more high-level and returns the default value for the default profile if it isn't explicitly set (e.g. when you only have the one default profile).maxschlepzig– maxschlepzig2018年03月18日 19:20:01 +00:00Commented Mar 18, 2018 at 19:20 -
The proposal for making ctrl-shift-click copy a URL to the clipboard is at bugzilla.gnome.org/show_bug.cgi?id=786935 The Ubuntu bug for the regression in which selecting URLs became harder in 15.10, is here, if you want to chime in. bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1501250nealmcb– nealmcb2018年06月29日 15:20:44 +00:00Commented Jun 29, 2018 at 15:20