Page MenuHomePhabricator

Finer grain control of active links
Closed, ResolvedPublic


Currently there is only a single option to control whether all links should be active or not. I like having the ability to click on web links (http and https), but I don't like other links being active (mailto and absolute/relative files in the filesystem). It would be much better if I could enable/disable active links based on the type of the link, for at least http, https, mailto, file, absolute file path, relative file path.

devkev created this task.Nov 7 2017, 5:32 PM
billiob triaged this task as Wishlist priority.Mar 10 2018, 12:31 PM
billiob closed this task as Wontfix.
billiob claimed this task.

This would clutted the interface.
I won't do it. Sorry :(

devkev reopened this task as Open.Dec 17 2018, 4:12 PM

FYI, this is still my #1 most disliked aspect of terminology.

The path detection is often wrong and/or inconsistent. It's relative to the terminology cwd (I believe), not the cwd of the shell inside the terminal. Likewise email detection is sometimes flaky (eg. in wee-slack when someone tags "@first.last", it's considered an email address).

Yes, these problems should be reported separately and fixed, but they are only part of my issue. The real issue is that I don't use a desktop email program, so I literally never want to click on mailto links (I wish I could banish them from my browser also). I also don't use graphical/desktop programs much at all, so I also never actually click on paths. The only time I click on either of these is by accident. I want them gone.

Additionally, not adding useful features/options because of "UI clutter" is not really justified. If the UI is cluttered, then the UI should be fixed. UI limitations shouldn't be used to justify not adding useful features.

In any case, if you don't want to add 6 new options, would you consider adding just 3, for email, path, and url? This is pretty easy to do and should be a good compromise. Alternatively, would you consider adding this customisation through some other (non-option) means? For example, I'm currently using the below patch to do this via env vars, and it's working well (I have a wrapper terminology script which sets the vars before launching the terminal). This wouldn't allow per-terminal customisation with single-process, or allow users to change their prefs on the fly. The code is a bit lazy, but I can't invasively refactor if I need to be applying this patch forever, and it works well enough for my use case, which is just getting rid of all email and path links forever. But I expect it wouldn't take much clean it up, including to use proper options if desired.

diff --git a/src/bin/termio.c b/src/bin/termio.c
index abf6ae6..5364d66 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -855,6 +855,51 @@ termio_link_get(const Evas_Object *obj)
    return strdup(link);

+static char *inhibit_email_active_links = NULL;
+static char *inhibit_path_active_links = NULL;
+static char *inhibit_url_active_links = NULL;
+static Eina_Bool init_inhibit_email_active_links = EINA_FALSE;
+static void
+   if (!init_inhibit_email_active_links) {
+       inhibit_email_active_links = getenv("TERMINOLOGY_INHIBIT_EMAIL_ACTIVE_LINKS");
+       inhibit_path_active_links = getenv("TERMINOLOGY_INHIBIT_PATH_ACTIVE_LINKS");
+       inhibit_url_active_links = getenv("TERMINOLOGY_INHIBIT_URL_ACTIVE_LINKS");
+       init_inhibit_email_active_links = EINA_TRUE;
+   }
+static Eina_Bool
+_is_link_inhibited(const char *link)
+   const char *path = NULL;
+   Eina_Bool url = EINA_FALSE, email = EINA_FALSE;
+   if (!link)
+     return EINA_TRUE;
+   if (link_is_url(link))
+     url = EINA_TRUE;
+   else if (link[0] == '/')
+     path = link;
+   else if (link_is_email(link))
+     email = EINA_TRUE;
+   if (url && casestartswith(link, "mailto:"))
+     {
+        email = EINA_TRUE;
+        url = EINA_FALSE;
+     }
+   _init_inhibitors();
+   return (email && inhibit_email_active_links)
+       || (path && inhibit_path_active_links)
+       || (url && inhibit_url_active_links);
 static void
 _activate_link(Evas_Object *obj, Eina_Bool may_inline)
@@ -874,6 +919,8 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
    if (!link)

+   if (_is_link_inhibited(link)) return;
    if (link_is_url(link))
      url = EINA_TRUE;
    else if (link[0] == '/')
@@ -3806,6 +3853,8 @@ _smart_mouseover_apply(Evas_Object *obj)

+   if (_is_link_inhibited(s)) return;
    if (sd->link.string)
    sd->link.string = eina_stringshare_add(s);