1

I'm just wondering how it would be possible to set a theme to my terminal windows according to the program/command I'm running in it.

In order to make it as clear as possible, here is an example :


I often use several terminal windows in order to manage programs or commands simultaneously, such as :

  1. grep -Ril a pattern in a set of text files
  2. watch ls in a specific directory
  3. grep a pattern in a specific file
  4. Launch a program
  5. navigate

So would it be possible to assign a specific background colour for each terminal widow depending on that ?

In this example :

  1. grep --> purple
  2. ls --> brown
  3. grep --> purple
  4. program --> grey
  5. navigate --> black
0

You can use shell alias to both send the appropriate ANSI codes to the screen to change the color, and temporarily set the TERM variable to something that'll ensure that whatever you're running won't issue ANSI codes itself.

Or maybe run the command and pipe its output through the appropriate stripper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.