Ubuntu 通过命令更改Gnome终端中的背景色?
我使用的是Gnome终端,我想通过命令更改背景颜色或配置文件,这样我就可以在别名中对一些命令进行分组,以便在运行某些进程时直观地区分我的窗口。我在运行Ubuntu,bash是我的shell。中是否有用于执行此操作的命令?我以前使用xterm的命令行参数来执行此操作。我设置了我的.olvwm(我自己在约会吗)以执行4个不同背景颜色的XTERM。假设您在打开终端之前知道您想要的配置文件: 右键单击面板和“添加到面板”并添加自定义应用程序启动器 您可以定义位置、大小和轮廓(考虑颜色、字体等)Ubuntu 通过命令更改Gnome终端中的背景色?,ubuntu,Ubuntu,我使用的是Gnome终端,我想通过命令更改背景颜色或配置文件,这样我就可以在别名中对一些命令进行分组,以便在运行某些进程时直观地区分我的窗口。我在运行Ubuntu,bash是我的shell。中是否有用于执行此操作的命令?我以前使用xterm的命令行参数来执行此操作。我设置了我的.olvwm(我自己在约会吗)以执行4个不同背景颜色的XTERM。假设您在打开终端之前知道您想要的配置文件: 右键单击面板和“添加到面板”并添加自定义应用程序启动器 您可以定义位置、大小和轮廓(考虑颜色、字体等) “人类g
“人类gnome终端”有很多有用的信息你想使用gconftool Gnome将其设置保存在类似于Windows注册表的层次结构中。知道要更改的项的路径后,可以从命令行使用gconftool设置该项的值 使用gconf编辑器浏览Gnome设置。
使用gconftool设置脚本中项目的值 在您的情况下,您需要执行以下操作: gconftool --type string --set /desktop/gnome/background/primary_color "#dadab0b08282" gconftool--键入字符串--set/desktop/gnome/background/primary"颜色“#dadab0b08282”
很明显,您需要用您想要的任何颜色替换该颜色值。我查看了它,结果发现这是不可能的。我提出了错误:
gconftool-2可以获取/设置配置文件属性,但无法为现有的、打开的gnome终端编写脚本。您可以像这样使用setterm
setterm -term linux -back blue -fore white -clear
1) 创建具有所需颜色和设置的终端配置文件,并将其命名为“myGterm”2) 编辑您的
.bashrc
文件。3) 添加以下行:
alias Gterm='gnome-terminal --window-with-profile=myGterm'
4) 保存并关闭.bashrc
5) 打开终端并键入:
$ Gterm
6) 瞧 要创建具有不同背景和标题的4个终端,您需要将以下行添加到.bashrc_配置文件中
$.bash_profile
将下面的行添加到文件中
alias term1='gnome-terminal –window-with-profile=term1'
alias term2='gnome-terminal –window-with-profile=term2'
alias term3='gnome-terminal –window-with-profile=term3'
alias term4='gnome-terminal –window-with-profile=term4'
关闭所有打开的端子,然后重新打开一个新端子,键入“term1”,点击回车键,然后对所有4个端子重复此操作。现在,您有4个唯一的端子打开 从桌面启动器尝试以下命令:
gnome-terminal --window-with-profile=site2 -x ssh site2
使用
-x ssh
意味着终端将仅在远程站点上处于活动状态,因此完全消除了在错误机器上键入命令的可能性,因为您已从终端命令行ssh退出。我基于其他线程的github代码创建了一些函数。对不起,我不记得了
您可以将这些函数放在~/.bashrc文件中
如您所见,如果调用“创建随机配置文件”
首先,它将检查并挖掘您之前创建的任意配置文件
其次,它将在gnome终端中创建一个随机名称配置文件
第三,它将在环境变量中设置该名称,您可以使用该名称在预定义函数中更改颜色。请参阅最后一个函数setcolord()
这应该很有用,因为有许多不同颜色的端子。此外,通过预定义的功能,您可以随时更改这些颜色。
享受吧
function create_random_profile() {
#delete previous profiles in case there were something
#delete_one_random_profile
prof="`mktemp -u HACK_PROFILE_XXXXXXXXXX`"
gconftool-2 --type list --list-type string --set $prof_list "`gconftool-2 --get $prof_list | sed "s/]/,$prof]/"`"
file="`mktemp`"
gconftool-2 --dump "/apps/gnome-terminal/profiles/Default" | sed "s,profiles/$2,profiles/$prof,g" > "$file"
gconftool-2 --load "$file"
gconftool-2 --type string --set "/apps/gnome-terminal/profiles/$prof/visible_name" "$prof"
gconftool-2 --set "/apps/gnome-terminal/profiles/$prof/use_theme_colors" --type bool false
rm -f -- "$file"
export __TERM_PROF=$prof
}
function delete_one_random_profile() {
regular="HACK_PROFILE_"
prof=$(gconftool-2 --get /apps/gnome-terminal/global/profile_list | sed -n "s/.*\(HACK_PROFILE_..........\).*/\1/p")
if [ ! -z "$prof"]; then
echo "size ${#prof}"
echo "size of regular ${#regular}"
echo "DO DELETE of $prof"
#if not empty
gconftool-2 --type list --list-type string --set $prof_list "`gconftool-2 --get $prof_list | sed "s/$prof//;s/\[,/[/;s/,,/,/;s/,]/]/"`"
gconftool-2 --unset "/apps/gnome-terminal/profiles/$prof"
else
echo "NOTHING TO DELETE"
fi
}
function setcolord()
{
echo "Dont forget to change to Profile0 in the menu of your terminal->Change Profile->Profile_0"
gconftool-2 --set "/apps/gnome-terminal/profiles/$__TERM_PROF/background_color" --type string white
gconftool-2 --set "/apps/gnome-terminal/profiles/$__TERM_PROF/foreground_color" --type string black
}
function setcolor_cyan()
{
echo "Dont forget to change to $__TERM_PROF in the menu of your terminal->Change Profile->Profile_0"
gconftool-2 --set "/apps/gnome-terminal/profiles/$__TERM_PROF/background_color" --type string "#8DCBCC"
gconftool-2 --set "/apps/gnome-terminal/profiles/$__TERM_PROF/foreground_color" --type string black
}
顺便说一句,如果您已经使用随机创建了终端,那么您可以节省时间。您可以通过以下方式进行操作:
gnome-terminal --working-directory=$HOME --window-with-profile="$prof"
您不必通过命令执行此操作,您可以转到编辑>>首选项>>颜色来更改它。嗯,xterm有直接的方法来更改颜色、字体和大小: xterm-bg Blue1-fg white-fa“单空间”-fs 9 为什么使用gnome终端
sudo apt-get install dconf-cli uuid-runtime
bash -c "$(wget -qO- https://git.io/vQgMr)"
通过输入数字选择你想要的主题我想他指的是gnome终端背景投票,为我指明了正确的方向,但是OP要求gnome终端--
gconftool--type bool--set/apps/gnome-terminal/profiles/Default/use_-theme_-colors-false
去掉不适合ls命令的可怕的紫色背景,即带有彩色输出的ls命令。这只是setterm
可用的平台的一个选项;例如,solaris没有setterm
。这将使用指定的配置文件打开一个新窗口,它不会影响当前窗口。对我来说,new profile
选项位于Terminal>File>new profile
下。在“window with profile”选项之前,必须有一个双减号。对我来说,它只适用于:alias term1='gnome-terminal--profile=term1'的窗口
sudo apt-get install dconf-cli uuid-runtime
bash -c "$(wget -qO- https://git.io/vQgMr)"