Gnome Terminal – Double Click Selection Guide

clipboardgnome-terminalgnome3

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:

Best Answer

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.

Related Question