mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
Work around Konsole not recognizing file:://$hostname/path as local
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
This commit is contained in:
@@ -213,7 +213,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user