On Mon, Mar 21, 2011 at 10:42:36PM +0100, Michael Schutte wrote: > Hi Alexey, > > The console-setup package in Debian needs a way to check for the > text/graphics mode of the active VT (from a shell script). This can be > done with “setfont -v -o /dev/null”, for example, but that isn’t very > elegant. Julien Cristau has proposed a small utility (which I’m calling > “vt_mode” for now) to report this information in a canonical fashion. I wonder whether you actually need to know what's the KD_ mode, or maybe your scripts just need yes/no answers on simple two questions: - whether the active VT is in the text mode? - whether the active VT is in the graphics mode? In the latter case, I suggest to implement an utility with an option or argument specifying what mode to query, and a tty(1)-like exit status, so its use would be as simple as "if vt_mode text; then ...; fi". -- ldv