From 880aa479bfe5373727ebdaf14fd8a01e906010bc Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 1 Mar 2025 20:41:23 +0100 Subject: [PATCH] Work around Konsole not recognizing file:://$hostname/path as local (This regressed in version 4 which sends OSC 7 to all terminals) Konsole has a bug: it does not recognize file:://$hostname/path as directory. When we send that via OSC 7, that breaks Konsole's "Open Folder With" context menu entry. OSC 7 producers are strongly encouraged to set a non-empty hostname, but it's not clear if consumers are supposed to accept an empty hostname (see https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/20). I think it should be fine; implementations should treat it as local path. Let's work around the Konsole bug by omitting the hostname for now. This may not be fully correct when using a remote desktop tool to access a system running Konsole but I guess that's unlikely and understandable. We're using KONSOLE_VERSION, so it the workaround should not leak into SSH sessions where a hostname component is important. Closes #11198 Proposed upstream fix https://invent.kde.org/frameworks/kio/-/merge_requests/1820 (cherry picked from commit c926a87bdbcac49dcded095b82391e4f92c6a0ad) --- share/functions/__fish_config_interactive.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 50bd5d891..ab00671de 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -221,7 +221,11 @@ end" >$__fish_config_dir/config.fish # Notify terminals when $PWD changes via OSC 7 (issue #906). function __fish_update_cwd_osc --on-variable PWD --description 'Notify terminals when $PWD changes' - printf \e\]7\;file://%s%s\a $hostname (string escape --style=url -- $PWD) + set -l host $hostname + if set -q KONSOLE_VERSION + set host '' + end + printf \e\]7\;file://%s%s\a $host (string escape --style=url -- $PWD) end __fish_update_cwd_osc # Run once because we might have already inherited a PWD from an old tab