I wrote an addon to tmux, tmux-gitbar, it adds to tmux status bar some information about the current Git working tree (name of local and remote branch, working tree is clean?, etc.). So basically it's modifying the content of tmux status bar.

I'm currently writing a suite of automated tests and I'd like to capture the actual content of the tmux status bar in order to perform some checks.

I tried with the unix script tool, also with ttyrec, both used to realize terminal session recordings. They grab the whole terminal content, but not the status bar.

How would I do that?


In fact, I was able to capture tmux status bar using both script and ttyrec. To do so I only had to run them before starting tmux. As these tools grab current terminal, they are not aware of the parent terminal in which you started tmux. Starting them before tmux made them be see the terminal rows and cols in which tmux creates its status bar.

I'm still looking for another solution though, as I do not find it really stable to parse the binaries produced by script or ttyrec as part of my integration test suite. However, one tool looks promising for the task: a vt100 emulator library written in python, but I'm still open to suggestions/solutions.

1 Answer 1


Answering my own question.

After some research, yes, I found a reliable way to capture the output of any terminal based app: using a VT100 terminal emulator.

VT100 is now the de-facto standard for all virtual terminal applications and tmux is an application interacting with a terminal, its content can be scrapped as well as its status bar.

The library I used for that is pyte that does the job well.
There are probably many others

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .