From 3c98a9430b275d75a42fcbda837a16958c8dd94b Mon Sep 17 00:00:00 2001 From: David Lindbom Date: Fri, 12 Nov 2021 22:53:39 +0100 Subject: [PATCH] LibVT: Show action of double click in tooltip When hovering an item in Terminal we now show what application will handle it, e.g "Open app-catdog.png in ImageViewer". If the file is its own handler, i.e an executable, it will show "Execute myscript.sh" --- Userland/Libraries/LibVT/TerminalWidget.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 4820d81fe6..50da722730 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -822,7 +822,18 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event) if (attribute.href_id != m_hovered_href_id) { if (m_active_href_id.is_null() || m_active_href_id == attribute.href_id) { m_hovered_href_id = attribute.href_id; - m_hovered_href = attribute.href; + auto handlers = Desktop::Launcher::get_handlers_for_url(attribute.href); + if (!handlers.is_empty()) { + auto path = URL(attribute.href).path(); + auto name = LexicalPath::basename(path); + if (path == handlers[0]) { + m_hovered_href = String::formatted("Execute {}", name); + } else { + m_hovered_href = String::formatted("Open {} with {}", name, LexicalPath::basename(handlers[0])); + } + } else { + m_hovered_href = attribute.href; + } } else { m_hovered_href_id = {}; m_hovered_href = {};