最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ansi escape - Display progress bar in terminal tab with an ASCII OSC Sequence - Stack Overflow

programmeradmin2浏览0评论

The vte library and gnome-terminal implemented recently the presentation progress indicators. It should look like this:

See: The circle icon on left of the second tab. The progress bar within the terminal is not of interest.

The API to control terminals are ANSI escape codes. Here specifically Operating System Commands (OSC). I tried using it with bash and echo to test it:

# Set the progress bar to 50% AND wait five seconds
echo -ne "\033]9;4;1;50\a" && sleep 5

Nothing visible happens. To be sure, I opened multiple tabs and added sleep 5.

I recognized that setting the title of the terminal with

echo -en "\e]0; New TITLE\a" && sleep 5

works, but to avoid a mere brief flashing of the title, it is necessary to keep the command running for some time. Features like Control Sequence Introducers (CSI)

echo -en "\e[31m RED TEXT COLOR \e[0m DEFAULT TEXT COLOR\n"

also work. Mind the opening square bracket for CSI.

What am I doing wrong?
I'm running gnome-terminal 3.65.0 with vte 0.80.0.

Thanks :)

Other references:

  • Linux Console: Terminal Controls
  • Julia Evans: Standards for ANSI escape codes
  • ConEmu
  • Microsoft

The vte library and gnome-terminal implemented recently the presentation progress indicators. It should look like this:

See: The circle icon on left of the second tab. The progress bar within the terminal is not of interest.

The API to control terminals are ANSI escape codes. Here specifically Operating System Commands (OSC). I tried using it with bash and echo to test it:

# Set the progress bar to 50% AND wait five seconds
echo -ne "\033]9;4;1;50\a" && sleep 5

Nothing visible happens. To be sure, I opened multiple tabs and added sleep 5.

I recognized that setting the title of the terminal with

echo -en "\e]0; New TITLE\a" && sleep 5

works, but to avoid a mere brief flashing of the title, it is necessary to keep the command running for some time. Features like Control Sequence Introducers (CSI)

echo -en "\e[31m RED TEXT COLOR \e[0m DEFAULT TEXT COLOR\n"

also work. Mind the opening square bracket for CSI.

What am I doing wrong?
I'm running gnome-terminal 3.65.0 with vte 0.80.0.

Thanks :)

Other references:

  • Linux Console: Terminal Controls
  • Julia Evans: Standards for ANSI escape codes
  • ConEmu
  • Microsoft
Share edited 11 hours ago oguz ismail 51k16 gold badges59 silver badges78 bronze badges asked 23 hours ago PeterPeter 2,3283 gold badges27 silver badges39 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

It seems to me that VTE insists that the escape sequence ends in the official ST (\e\\) rather than the nonstandard, unofficial BEL (\a).

发布评论

评论列表(0)

  1. 暂无评论