Consider removing or reworking DEC Reverse Video (DECSCNM) support
tput flash
performs the equivalent of printf '\e[?5h'; sleep 0.1; printf '\e[?5l'
, flashing the terminal (setting "reverse video") for a moment.
It is extremely annoying (see gnome-terminal#8036 (closed)), has the potential of causing seizures, and reflects the state of computer science as of perhaps like 40 years ago.
Different terminals implement it differently:
-
foot
,mlterm
,urxvt
,vte
,xterm
: swap the default fg and bg colors (but e.g. a red foreground remains red foreground); -
kitty
,konsole
,Linux vt
,pterm
,terminology
,Windows Terminal
: swap the fg and bg of each cell (e.g. a red foreground becomes red background); -
st
: photo negative (e.g. red foreground becomes cyan foreground); -
alacritty
,screen
,tmux
: not supported;
therefore I'm pretty sure that no application can use it for any purpose other than a brief flashing.
We could perhaps treat \e[?5h
as equivalent to \a
(audible bell, subject to the corresponding setting) and do nothing on \e[?5l
. Or show an (animated) bell icon in the header bar for a few seconds (maybe even for \a
). Or gradually fade across those two colors. Or anything similar, less intrusive, more pleasant way of alerting.