-
Notifications
You must be signed in to change notification settings - Fork 715
Distinguish between focused and unfocused clients in Tmux
Vladimir Bauer edited this page Jan 15, 2021
·
1 revision
Although tmux highlights active pane's borders and even lets to customize them via pane-active-border-style
option, it's sometimes more desirable to instantly distinguish between focused and unfocused clients, as tiny borders are not so visible. Here is a script to achieve this via toggling status line background color:
# StatusLine face toggle
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
declare-option -hidden str last_focus_in
declare-option -hidden str focus_out_face "rgb:FDFDFD,rgb:8e908c"
hook global -group status-line-face-toggle FocusIn .* %{
set-option global last_focus_in %val{client}
unset-face window StatusLine
evaluate-commands %sh{
for client in $kak_client_list; do
if [ "$client" != "$kak_hook_param" ]; then
printf "eval -no-hooks -client %s 'set-face window StatusLine %s'\n" \
"$client" "$kak_opt_focus_out_face"
fi
done
}
}
hook global -group status-line-face-toggle WinDisplay .* %{
evaluate-commands %sh{
if [ "$kak_client" == "$kak_opt_last_focus_in" ]; then
echo "unset-face window StatusLine"
elif [ -n "$kak_opt_last_focus_in" ]; then
printf "set-face window StatusLine %s\n" "$kak_opt_focus_out_face"
fi
}
}
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV