linux - How to change colors programmatically in Konsole based on current directory? -


I currently use a color scheme on which I am working. I manually opened a console shell and then found the CD in one directory and in the settings and changed the color scheme.

What I would like to do is that the console automatically sets its foreground and background colors on which I am based on that directory. Basically if I have a meter in any subdirectory below / home / me / src / java then I would like to use text white, background blue for example. For example, if I am down / home / me / src / documentation, I want text black, background white. I would like the color change to happen automatically, programmatically, when I call the "cd" command.

Is this possible? If so, how can you provide me some directions?

The way I see it, I should be able to do some things:

  • The shell process is running to detect the console.
  • Be able to tell the console, possibly through the API call, to change the color scheme on the fly.
  • To get you started, talk about using D-Bus script console A little information.

    You do not say which shell you are using, but if it is a bash then you can use the $ PROMPT_COMMAND variable, which will be executed every time Keeps an order for $ PS1 prompt has been released. Jade Shell has such a feature which is probably a little more powerful (see man zshmisc for chpwd and Precmd ).

    Otherwise, you may be able to use.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -