How to change Terminal background color when I open new tab?

三世轮回 提交于 2019-12-23 01:54:46

问题


I wanted to change color when I login to remote server by ssh.

The problem solved by this question.

How do I make the apple terminal window auto change colour scheme when I ssh to a specific server

But the solution above have a little problem.

  1. Connet to remote server by ssh. (Background color is changed)
  2. Open new terminal Tab.
  3. This Tab's background is still changed.

So I want to "reset" background color when I open new Terminal Tab. How can I do it?


回答1:


By default, Terminal creates new tabs with the same settings as the current tab. You can change it to always use your default profile for new tabs in Preferences > Startup by changing New tabs open with: to Default Settings.

Note that there’s a built-in way to automatically set the background color for specific commands instead of using the script from that other answer:

You can set the name of a settings profile to a command name and Terminal will select that profile when you create a new terminal via either Shell > New Command… or Shell > New Remote Connection….

For example, duplicate your default profile, name it “ssh” and set its background color to red. Then use New Command… to run ssh host.example.com.

It also matches on arguments, so you can have it choose different settings for different remote hosts, for example. You could have one named “ssh host.example.com” with a blue background and another named “ssh” with a red background to handle any ssh commands that don’t match other profiles.



来源:https://stackoverflow.com/questions/18715941/how-to-change-terminal-background-color-when-i-open-new-tab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!