fix: more consistent terminal title
This commit is contained in:
@@ -211,13 +211,13 @@ providers=Genius, Lyrics.ovh, LoloLyrics, Musixmatch, songlyrics.com, azlyrics.c
|
|||||||
[MainWindow]
|
[MainWindow]
|
||||||
current_tab=1
|
current_tab=1
|
||||||
file_path=/home/oscar/Music
|
file_path=/home/oscar/Music
|
||||||
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\a\x80\0\0\0\0\0\0\x11\x7f\0\0\x5W\0\0\a\x81\0\0\0\x19\0\0\v\xeb\0\0\x2\xc5\0\0\0\x1\x2\0\0\0\n\0\0\0\a\x80\0\0\0\0\0\0\x11\x7f\0\0\x5W)
|
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x11\x80\0\0\0\0\0\0\x18\xff\0\0\x4g\0\0\x11\x81\0\0\0\x19\0\0\x15\xeb\0\0\x2\xc5\0\0\0\x2\x2\0\0\0\a\x80\0\0\x11\x80\0\0\0\0\0\0\x18\xff\0\0\x4g)
|
||||||
hidden=false
|
hidden=false
|
||||||
maximized=true
|
maximized=true
|
||||||
minimized=false
|
minimized=false
|
||||||
search_for_cover_auto=true
|
search_for_cover_auto=true
|
||||||
show_sidebar=true
|
show_sidebar=true
|
||||||
splitter_state=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\x1\x36\0\0\x4W\0\xff\xff\xff\xff\x1\0\0\0\x1\0)
|
splitter_state=@ByteArray(\0\0\0\xff\0\0\0\x1\0\0\0\x2\0\0\x1\xbb\0\0\x5\xc4\0\xff\xff\xff\xff\x1\0\0\0\x1\0)
|
||||||
tab_collection=1
|
tab_collection=1
|
||||||
tab_context=0
|
tab_context=0
|
||||||
tab_devices=7
|
tab_devices=7
|
||||||
@@ -280,14 +280,15 @@ remove_problematic=true
|
|||||||
replace_spaces=false
|
replace_spaces=false
|
||||||
|
|
||||||
[Player]
|
[Player]
|
||||||
playback_playlist=-1
|
playback_playlist=1
|
||||||
playback_position=0
|
playback_position=16
|
||||||
playback_state=0
|
playback_state=3
|
||||||
volume=100
|
volume=100
|
||||||
|
|
||||||
[Playlist]
|
[Playlist]
|
||||||
alternating_row_colors=true
|
alternating_row_colors=true
|
||||||
auto_sort=false
|
auto_sort=false
|
||||||
|
column_alignments=@Variant(\0\0\0\x7f\0\0\0\x13\x43olumnAlignmentMap\0\0\0\0\v\0\0\0\x6\0\0\0\x82\0\0\0\a\0\0\0\x82\0\0\0\b\0\0\0\x82\0\0\0\t\0\0\0\x82\0\0\0\n\0\0\0\x82\0\0\0\f\0\0\0\x82\0\0\0\r\0\0\0\x82\0\0\0\xe\0\0\0\x82\0\0\0\x11\0\0\0\x82\0\0\0\x15\0\0\0\x82\0\0\0\x16\0\0\0\x82)
|
||||||
continue_on_error=false
|
continue_on_error=false
|
||||||
delete_files=false
|
delete_files=false
|
||||||
editmetadatainline=false
|
editmetadatainline=false
|
||||||
@@ -300,6 +301,8 @@ rating_locked=false
|
|||||||
select_track=false
|
select_track=false
|
||||||
show_bars=true
|
show_bars=true
|
||||||
show_toolbar=true
|
show_toolbar=true
|
||||||
|
state="@ByteArray(P,\x95\x10\x1\0\0\0 \0\0\0\b\0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x6\0\0\0\a\0\0\0\t\0\0\0\n\0\0\0\v\0\0\0\f\0\0\0\r\0\0\0\xe\0\0\0\xf\0\0\0\x10\0\0\0\x11\0\0\0\x12\0\0\0\x13\0\0\0\x14\0\0\0\x15\0\0\0\x16\0\0\0\x17\0\0\0\x18\0\0\0\x19\0\0\0\x1a\0\0\0\x1b\0\0\0\x1c\0\0\0\x1d\0\0\0\x1e\0\0\0\x1f\0\0\0 \0\0\x1\x15\0\0\x1H\0\0\x1\x89\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0>\0\0\0\0\0\0\0\x42\0\0\0\0\0\0\0R\0\0\0?\0\0\0>\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0:\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\b\0\0\0\n\0\0\0\f\0\0\0\r\0\0\0\xe\0\0\0\x12\0\0\0\x1a\0\0\0 ?\xc8i\xfb\xbd\xea\xca\xe2?\xcc\xdb\xf4\x8cW\x14\x41?\xd1P\xeb\xa0\xfd}\xec\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0?\xa5\xe7\x62\xd6\xdboV\0\0\0\0\0\0\0\0?\xa7\x81\xd0T\xf5\xd3\xe0\0\0\0\0\0\0\0\0?\xac\xecp]\x1a\x64\xef?\xa6\x83\xa8>\xca\xd1\xf3?\xa5\xdd\x19\xddH\x18\x8d\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0?\xa5/\x9a\xe2_\xec\xc3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0?\xa4z\xe1G\xae\x14{\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0)"
|
||||||
|
state_version=1
|
||||||
warn_close_playlist=true
|
warn_close_playlist=true
|
||||||
write_metadata=false
|
write_metadata=false
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
_here="$(dirname -- "$(readlink -f -- "${HOME}/.zshrc")")"
|
_here="$(dirname -- "$(readlink -f -- "${HOME}/.zshrc")")"
|
||||||
_cache_dir="${XDG_CACHE_HOME:-"${HOME}/.cache"}/zsh"
|
_cache_dir="${XDG_CACHE_HOME:-"${HOME}/.cache"}/zsh"
|
||||||
|
|
||||||
if [[ ! -d "${_cache_dir}" ]]; then
|
if [[ ! -d ${_cache_dir} ]]; then
|
||||||
mkdir -p "${_cache_dir}"
|
mkdir -p "${_cache_dir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -98,14 +98,14 @@ _antidote="${_cache_dir}/antidote"
|
|||||||
_plugins="${_here}/plugins"
|
_plugins="${_here}/plugins"
|
||||||
_plugins_cache="${_cache_dir}/plugins"
|
_plugins_cache="${_cache_dir}/plugins"
|
||||||
|
|
||||||
if [[ ! -d "$_antidote" ]]; then
|
if [[ ! -d $_antidote ]]; then
|
||||||
git clone --depth=1 https://github.com/mattmc3/antidote.git "$_antidote"
|
git clone --depth=1 https://github.com/mattmc3/antidote.git "$_antidote"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fpath=("${_antidote}/functions" "${fpath[@]}")
|
fpath=("${_antidote}/functions" "${fpath[@]}")
|
||||||
autoload -Uz antidote
|
autoload -Uz antidote
|
||||||
|
|
||||||
if [[ ! "${_plugins_cache}" -nt "${_plugins}" ]]; then
|
if [[ ! ${_plugins_cache} -nt ${_plugins} ]]; then
|
||||||
antidote bundle <"${_plugins}" >"${_plugins_cache}"
|
antidote bundle <"${_plugins}" >"${_plugins_cache}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -119,19 +119,44 @@ unset _antidote _plugins _plugins_cache
|
|||||||
# Ref: https://zsh.sourceforge.io/Doc/Release/Functions.html#Functions
|
# Ref: https://zsh.sourceforge.io/Doc/Release/Functions.html#Functions
|
||||||
|
|
||||||
function set_terminal_title() {
|
function set_terminal_title() {
|
||||||
if [ -n "$SSH_CLIENT" ]; then
|
local title cwd host extra
|
||||||
return
|
local -a parts
|
||||||
|
|
||||||
|
extra="$1"
|
||||||
|
|
||||||
|
parts=()
|
||||||
|
if [ -n "$SSH_CONNECTION" ] && [ -z "$TMUX" ]; then
|
||||||
|
local -a tmp
|
||||||
|
tmp=("${=SSH_CONNECTION}")
|
||||||
|
host=${tmp[3]}
|
||||||
|
parts+=("$host")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local title
|
if [ "$PWD" = "$HOME" ]; then
|
||||||
if [ -z "$1" ]; then
|
cwd="~"
|
||||||
title=$(basename "$(print -P "%~")")
|
|
||||||
else
|
else
|
||||||
title="$1"
|
cwd="${PWD##*/}"
|
||||||
fi
|
fi
|
||||||
|
parts+=("$cwd")
|
||||||
|
|
||||||
|
if [ -n "$extra" ]; then
|
||||||
|
parts+=("$extra")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# shellcheck disable=SC2296
|
||||||
|
title="${(j|:|)parts}"
|
||||||
|
|
||||||
echo -ne "\033]2;$title\033\\"
|
echo -ne "\033]2;$title\033\\"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preexec() {
|
||||||
|
local cmd
|
||||||
|
|
||||||
|
cmd=${1%% *}
|
||||||
|
|
||||||
|
set_terminal_title "$cmd"
|
||||||
|
}
|
||||||
|
|
||||||
function precmd() {
|
function precmd() {
|
||||||
set_terminal_title
|
set_terminal_title
|
||||||
}
|
}
|
||||||
@@ -142,26 +167,18 @@ function telnet_with_title() {
|
|||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
--bind=*)
|
--bind=*) ;&
|
||||||
;&
|
--escape=*) ;&
|
||||||
--escape=*)
|
--user=*) ;&
|
||||||
;&
|
--trace=*) ;&
|
||||||
--user=*)
|
|
||||||
;&
|
|
||||||
--trace=*)
|
|
||||||
;&
|
|
||||||
-[beln]?*)
|
-[beln]?*)
|
||||||
# Option with argument immediately after, like -blocalhost
|
# Option with argument immediately after, like -blocalhost
|
||||||
skip_next="false"
|
skip_next="false"
|
||||||
;;
|
;;
|
||||||
--bind)
|
--bind) ;&
|
||||||
;&
|
--escape) ;&
|
||||||
--escape)
|
--user) ;&
|
||||||
;&
|
--trace) ;&
|
||||||
--user)
|
|
||||||
;&
|
|
||||||
--trace)
|
|
||||||
;&
|
|
||||||
-[beln])
|
-[beln])
|
||||||
# Option with argument on next iteration
|
# Option with argument on next iteration
|
||||||
skip_next="true"
|
skip_next="true"
|
||||||
@@ -182,7 +199,7 @@ function telnet_with_title() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
set_terminal_title "${host}:${port}"
|
echo -ne "\033]2;${host}:${port}\033\\"
|
||||||
telnet "$@"
|
telnet "$@"
|
||||||
set_terminal_title
|
set_terminal_title
|
||||||
}
|
}
|
||||||
@@ -215,7 +232,7 @@ function ssh_with_title() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
set_terminal_title "$host"
|
echo -ne "\033]2;${host}\033\\"
|
||||||
ssh "$@"
|
ssh "$@"
|
||||||
set_terminal_title
|
set_terminal_title
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user