如何导出/导入 Ubuntu 16.04 终端配色方案

如何导出/导入 Ubuntu 16.04 终端配色方案

我正在尝试从 Ubuntu 16.04 终端导出配色方案以在另一个系统上使用。

我发现一些帖子建议:

gconftool-2 --dump '/apps/gnome-terminal' > gnome-terminal-conf.xml

...但这不再有效。我还发现有人建议使用terminal.sexy,但我正在寻找一种通过Ubuntu终端或我可以在本地使用的其他工具来执行此操作的方法。

答案1

我假设您指的是 Gnome 终端的配置文件,即终端中字体的颜色和大小、背景颜色等,而不是 GTK 窗口的样式和终端本身的小部件。
在 Ubuntu 16.04 中,GTK 版本已切换为 3,因此gconftool-2不再起作用,您需要使用gsettings.
这是bash我用来gnome-terminal在 Ubuntu 16.04 上重新创建我的配置文件的脚本:

user=YOUR_USERNAME_GOES_HERE

sudo -u $user bash << EOF || exit 1
    # working with gsettings
    #--------------------------
    # 
    # Getting a dump of the new settings
    # 
    # get a list of schemas - so that the schema can be fed into gsettings list-keys
    #
    #     gsettings list-relocatable-schemas | grep -i terminal
    #
    # produces
    # org.gnome.Terminal.SettingsList
    # org.gnome.Terminal.Legacy.Profile
    # org.gnome.Terminal.Legacy.Keybindings
    # 
    # taking "schema" org.gnome.Terminal.Legacy.Profile, produce a list of keys
    #     gsettings list-keys org.gnome.Terminal.Legacy.Profile
    # 
    # get UUID of default profile
    # there is some info on this here:
    # https://wiki.gnome.org/Apps/Terminal/FAQ#How_can_I_change_a_profile_setting_from_the_command_line.3F
    profile=$(gsettings get org.gnome.Terminal.ProfilesList default)
    profile=${profile:1:-1} # remove leading and trailing single quotes

    # getting/dumping values
    #-----------
    # gsettings get \
    #   org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
    #   background-transparency-percent


    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        use-theme-colors false

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        background-color "#393939"

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        scrollback-unlimited true

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        foreground-color "#eee"

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        use-transparent-background true

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        background-transparency-percent "10"
EOF

这些是我的偏好,我建议安装dconf-editor以找到需要修改的适当键以获得您自己的偏好。

相关内容