FYI :)
-------- Forwarded Message -------- Subject: [GoLUG] Graphical output on xterm Date: Thu, 27 Feb 2025 23:58:05 -0800 From: Kyle Terrien <k...@terren.us> Organization: Terrenus To: go...@golug.org Hi all, This is an old trick someone on Reddit told me years ago. Did you know that xterm can actually display vector graphics? What you need: + GNU plotutils + xterm Refer to “Simple examples using graph” [1]. Create a datafile with a bunch of points like the following: 0.0 0.0 1.0 0.2 2.0 0.0 3.0 0.4 4.0 0.2 5.0 0.6 Then, in an xterm, run graph -T tek < datafile Xterm displays a secondary window with a line plot. How does this work? In $current_year, xterm can still emulate a Tektronix 4014 [2]. The above graph command sends special escape codes that tell a Tektronix terminal to switch to graphical mode and draw an image. Xterm understands these codes, opens a secondary window, and draws the output. Note that you must use xterm, because unfortunately more modern VTE-based terminals like sakura, xfce4-terminal, and gnome-terminal do not understand Tektronix codes. Why is this so cool? This is a 100% in-band method of drawing vector graphics over a pty. It works over SSH, without X11 forwarding. All you need is a compatible terminal, i.e. xterm. I suppose it is possible to display images using this method. Such an approach could be insanely useful for diagnostic commands because some information is better formatted as a plot or image. Maybe we could have a graphical version of top that displays resource usage with actual plots updated in real time. Or maybe we can graph dependency relationships of system services. Someone wrote a tool for converting raster images to Tektronix codes [3]. I suppose there must be a way to convert SVG, or maybe ditch the SVG step entirely and output raw vector Tektronix codes. (systemd-analyze plot should implement this.) Another fun use would be to write games that use the Tektronix mode. Because this is a vector format, I suppose it is possible to output Asteroids. Missile Command and Snake are other good contenders, or if you are feeling truly edgy, try to reimplement “International Thermonuclear War” from the movie /Wargames/. It would look very oldschool in this format. --Kyle [1]: https://www.gnu.org/software/plotutils/manual/en/html_node/Simple-Examples.html [2]: https://en.wikipedia.org/wiki/Tektronix_4010 [3]: https://github.com/rricharz/make-tek-image -- [*] Kyle Terrien Terrenus => from the Earth, to the Cloud https://terren.us/ Dilexisti justitiam, et odisti iniquitatem. -- Psalmus 44:8 -- GoLUG mailing list go...@golug.org http://golug.org/mailman/listinfo/golug_golug.org