Ama*_*man 11 command-line gnome-terminal
有什么方法可以从命令行本身编辑终端首选项,如背景、颜色等?终端是 Gnome 终端。
我正在使用 Ubuntu 14.04 可信赖的 tahr。
这是我所做的:
安装 gconf 编辑器 sudo apt-get install gconf-editor
从终端启动它 gconf-editor
转到应用程序> gnome-terminal> 配置文件> gnome-editor 中的默认值
这将打开首选项的键值对。编辑与所需键对应的值。
感谢您为我指明方向,而不是给出确切的答案 @jasonwryan 。一路上我学到了一些其他的东西。
现在,我将尝试使用gconftool-2来做同样的事情。我正在尝试消除对 GUI 的需求 :)
有用的链接:什么是 Gconf
添加:使用 gconftool-2
程序 gconftool-2 允许用户从命令行与 Gconf 交互。
例如,您希望设置终端的背景暗度
所以,我们要设置的键/应用/ GNOME的终端/型材/默认/ background_darkness与值(假设0.50)
gconftool-2 --set /apps/gnome-terminal/profiles/Default/background_darkness --type=float 0.50
与此类似,我们可以设置更改不同键对应的其他值。
正如这个问题所指出的,从Ubuntu 15.10开始,Wily Werewolf gconf
已经取代了dconf
配置系统。
与其前身类似,它提供了一个 GUI 工具dconf-editor
,允许我们查看和配置其模式。要安装它,请运行
sudo apt install dconf-editor
Run Code Online (Sandbox Code Playgroud)
同样,我们可以通过命令行管理其配置,现在使用gsetting
. 例如,如果您想设置终端的背景透明度级别(假设为 50%),则必须将其更改为所需的终端配置文件。
中dconf
,org.gnome.Terminal.Legacy.Profile:
是存储终端配置文件的位置,因此您可以列出正在运行的现有配置文件 UUID gsettings get org.gnome.Terminal.ProfilesList list
,然后您可以通过更改所需的密钥
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:[target-profile-UUID]/ background-transparency-percent 50
Run Code Online (Sandbox Code Playgroud)
请注意,要实现更改,您还需要设置use-transparent-background
为true