Search code examples
terminalscreenshotcurses

Get screenshot of curses application


At a remote site I'm running a curses based application at a virtual console. If I'm not at the site to check the application I can view whats going on with any of these commands:

$ sudo screenshot 1
$ sudo cat /dev/vcs1

But the colourisation and borders gets screwed when I use those commands.

So this is roughly what I want and what I get:

what I want what I get

Can I somehow get the colourisation and borders (and all the rest) correctly displayed to me. I was thinking in the terms of something like this:

$ sudo mysuperscreenshot 1
$ sudo cat /dev/vcs1 > out.txt; vim out.txt
$ sudo cat /dev/vcs1 > out.txt; mysuperviewer out.txt
$ sudo myterminalimport /dev/vcs1 > out.png

As you might have noticed there is no X on the remote machine so something like import or gnome-screenshot will not work (at least as far as I understand).

Is this possible and in that case how? Is there some argument or application I'm missing?

If its not possible: why is that? Is there some conceptual thing I'm missing that make this question flawed?


Solution

  • The data that you can read back from the virtual console device omits the video-attributes — only the 8-bit characters that occupy each cell. There are no system calls which can give you this information (see the console_ioctl manual page).

    If you ran your application using screen (or tmux, etc.), then you could connect to that application and see something comparable on your local machine, with the caveat that neither is likely to do well translating line-drawing if the remote machine is not using a UTF-8 locale.