WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Invert console screen fun  (Read 2643 times)

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Invert console screen fun
« on: December 11, 2019, 08:16:45 PM »
Inverting the screen colors is useful to me when I'm not actually writing code, but magnificient prose for other humans to read.

Pretty easy from the console:

Invert the screen
Code: [Select]
echo -e '\033[?5h'
Back to normal:
Code: [Select]
echo -e '\033[?5l'
Works fine in the console, or even in Aterm.  Since I run multivt, or have many Aterm windows open at a time, inverting the screen makes it easy to identify one that I shouldn't mess with, like stopping a compile.

But notice how similar it looks to the command for console-blanking.  Let's put the two together and see where my fast fingers betrayed me when I couldn't figure out why my console wasn't blanking:

Code: [Select]
echo -e '\033[?5h'
echo -e '\033[9;10]'

The first one inverts the screen.  The second one sets console blanking to 10 minutes.

What burned me is when fooling around with console blanking, I would forget to add the right bracket.  So here's what happened when I lost attention to the right bracket:

1) If I used a right bracket ] with the screen invert, it would still invert, but just echo'ed out the spurious right bracket to the screen.

Code: [Select]
echo -e '\033[?5h]'Inverts, but spews that right bracket to screen

2) If I *forgot* to use the right bracket with the console-blanking, the system would happily accept it, but no blanking would occur.

Code: [Select]
echo -e '\033[9;10'Bzzzt!  no blanking.

Just a warning - I was tearing my hair out playing with shell scripts, and that missing right bracket got me with no console blanking.


« Last Edit: December 11, 2019, 08:24:41 PM by PDP-8 »
That's a UNIX book! - cool  -- Garth