更改GNOME终端编程主题 [英] Change Gnome terminal theme programmatically

查看:307
本文介绍了更改GNOME终端编程主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的本地机器(Ubuntu的GNOME),从而在终端窗口中有一个不同的背景颜色取决于我是否登录到我的本地机器或SSH方式登录远程计算机上创建一个安装。

I'd like to create a setup on my local machine (Ubuntu GNOME) whereby the terminal window has a different background color depending on whether I'm logged in to my local machine or ssh'd into a remote machine.

有没有办法做到这一点?

Is there a way to do this?

推荐答案

这不会做你问什么,但它可能是你想要的东西。

This doesn't do what you asked for, but it probably does what you want.

您可以修改的.bashrc (或等值外壳init文件)的基础上,无论您是使用SSH或不设置提示。

You can modify your .bashrc (or equivalent shell init file) to set your prompt based on whether you're using ssh or not.

即。把这样的:

if [ -n $SSH_TTY ]; then
     export PS1=`echo -en '\033[42m\w\$ '`;
fi;

你的的.bashrc 远程计算机上文件的末尾。在 \\ 033 [42米是一个 ANSI逃生code 改变背景颜色为绿色。

at the end of your .bashrc file on the remote machine. the \033[42m is an ANSI Escape Code that changes the background colour to green.

这样,你的终端的背景颜色将是绿色的(或洋红色,或青色,或其他)的只有的,当你登录到远程计算机。

This way, the background colour of your terminal will be green (or magenta, or cyan, or whatever) only when you're logged in to a remote machine.

这篇关于更改GNOME终端编程主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆