如何合并两个图标集?

ric*_*lla 15 themes icons

我想合并标准的 Ubuntu Mono 图标集和 Faenza 图标集。我想在面板中保留标准的 Ubuntu 图标(包括像 Dropbox、文件传输等的图标)并用 Faenza 版本替换所有其他应用程序图标。

我该怎么办?

idb*_*rii 13

我认为合并图标集的最佳方法是创建我所说的轻量级图标集。此图标集位于您的主目录中,因此它不会被系统更新破坏,但它链接到系统图标集,因此它将与它们一起更新。您系统上的其他用户将无法使用这些主题。

轻量级图标集

Ubuntu的主题经理将查找~/.icons/usr/share/icons图标的集合。~/.icons覆盖中的任何内容/usr/share/icons.因此您可以将系统目录中的图标集复制到您的主目录以自定义图标,并且您只包含要更改的部分!

一般来说,我认为最好使用系统图标制作自己的图标集。您可以通过创建一个图标集、一个 index.theme 文件并添加一些图标来做到这一点。但是,当您组合不同的图标集时,您需要覆盖它们的Inherits属性,以便您可以设置自己的优先顺序。

创建图标集以合并主题

让我们创建一个超级单声道图标集:

# Create a new icon set
mkdir -p ~/.icons/super-mono

# Copy an existing icon config and modify it for our new icon set
cp /usr/share/icons/Faenza-Darkest/index.theme      ~/.icons/super-mono/.
sed -ie "s/Name=Faenza-Darkest/Name=super-mono/"    ~/.icons/super-mono/index.theme
sed -ie "s/Comment=.*$/Comment=Created with by me/" ~/.icons/super-mono/index.theme
sed -ie "s/Inherits=/Inherits=ubuntu-mono-dark,/"   ~/.icons/super-mono/index.theme
Run Code Online (Sandbox Code Playgroud)

现在我们在 Appearance 中设置了一个与 Faenza-Darkest 完全一样的新图标。

为了合并我们的两个主题,我们将 super-mono 主题更改为继承自 ubuntu-mono-dark 和 Faenza。

sed -ie "s/Inherits=.*$/Inherits=ubuntu-mono-dark,Faenza/" ~/.icons/super-mono/index.theme
Run Code Online (Sandbox Code Playgroud)

对于richzilla来说应该够了,在Appearance里选择super-mono就行了。

添加自定义图标

我们还可以向这个图标集添加单独的图标:

ln -s /usr/share/icons/Faenza-Darkest/actions/22/gtk-paste.png ~/.icons/super-mono/actions/22/.
Run Code Online (Sandbox Code Playgroud)

现在我们的超级单声道主题结合了 ubuntu-mono-dark 和 Faenza,只是它使用了 Faenza-Darkest 中的一个图标。请参阅后面的部分以使用更多的图标。

重要的是我从 Faenza-Darkest 复制了 index.theme,然后使用了 Faenza-Darkest 的图标。index.theme 文件说明图标可能在哪里。如果您想从不同的图标集中提取单个图标,您需要合并它们的 index.theme 文件。您可以查看这些文件,您会看到一个名为“目录”的字段,其中列出了所有包含图标的文件夹。然后您将看到描述这些文件夹的其他字段。如果您添加这些字段未描述的图标,则该图标将被忽略。您可以在index.theme 规范中找到更多信息。

高级:有选择地组合三个图标集

我也喜欢 ubuntu-mono 图标。我喜欢 Faenza 的应用程序图标,我不喜欢 Faenza 的单色图标(指示器和按钮)。我也喜欢基本的图标。所以我想结合这三个图标集。据我所知,最好的方法是隔离你喜欢的图标。

  1. 使用 ubuntu-mono-dark
  2. 使用 Faenza 的应用程序图标
  3. 否则使用基本的图标

为此,我们需要告诉 ubuntu-mono-dark 不要继承任何东西(所以我们也可以使用 Faenza 和基本)。

# First, ubuntu-mono-dark
# Create a shadow of the system icon set
mkdir -p ~/.icons/ubuntu-mono-dark

# Copy an existing icon config and modify it for our shadow icon set
cp /usr/share/icons/ubuntu-mono-dark/index.theme   ~/.icons/ubuntu-mono-dark/.
sed -ie "s/Comment=.*$/Comment=A shadow to prevent inherits/" ~/.icons/ubuntu-mono-dark/index.theme
sed -ie "s/Inherits=.*$/Inherits=/"                ~/.icons/ubuntu-mono-dark/index.theme
Run Code Online (Sandbox Code Playgroud)

您会注意到 ubuntu-mono-dark 图标集现在已损坏。它将缺少由 Humanity-Dark 提供的图标和它继承的其他图标集。此更改只会影响您的用户。

现在我们可以使用 Faenza 的应用程序图标制作一个新的图标集。

# Create a new icon set
mkdir -p ~/.icons/Faenza-apps

# Copy the existing icon config and modify it for our new icon set
cp /usr/share/icons/Faenza/index.theme             ~/.icons/Faenza-apps/.
sed -ie "s/Name=Faenza/Name=Faenza-apps/"          ~/.icons/Faenza-apps/index.theme
sed -ie "s/Comment=.*$/Comment=Just Faenza app icons/" ~/.icons/Faenza-apps/index.theme
sed -ie "s/Inherits=.*$/Inherits=/"                ~/.icons/Faenza-apps/index.theme

# Use Faenza's app icons
ln -s /usr/share/icons/Faenza/apps/ ~/.icons/Faenza-apps/.
Run Code Online (Sandbox Code Playgroud)

这个 Faenza-apps 图标集也坏了。它只有应用程序图标。所有其他图标都丢失了,因为我们删除了继承。

现在我们创建我们将使用的图标集。我们的图标集将不包含任何图标,它只是连接我们的其他图标集。

# Create a new icon set
mkdir -p ~/.icons/merge-mono-dark

# Copy an existing icon config and modify it for our new icon set
cp /usr/share/icons/Faenza/index.theme                 ~/.icons/merge-mono-dark/.
sed -ie "s/Name=Faenza/Name=merge-mono-dark/"          ~/.icons/merge-mono-dark/index.theme
sed -ie "s/Comment=.*$/Comment=Created with by me/"    ~/.icons/merge-mono-dark/index.theme
sed -ie "s/Inherits=.*$/Inherits=ubuntu-mono-dark,Faenza-apps,elementary-mono-dark/" ~/.icons/merge-mono-dark/index.theme
Run Code Online (Sandbox Code Playgroud)

现在我们应该可以在 Appearance 中选择 merge-mono-dark 了,我们会有一个漂亮的新图标集!(注意:我们不需要合并 index.theme 文件,因为我们不会将来自不同图标集的图标添加到 merge-mono-dark。相反,我们使用 Inherits 来自动合并图标集。)


部分命令说明

我使用了很多终端命令来简化这个答案,但这里是对它们的作用的描述。

ln -s /usr/share/icons/Faenza-Darkest/actions/22/gtk-paste.png ~/.icons/Faenza-Alan/actions/22/.
Run Code Online (Sandbox Code Playgroud)

这会在您的图标集中创建一个指向系统图标集的 gtk-paste 图标的指针。这样就不会使用额外的硬盘空间,并且您的图标集会与系统的图标集一起更新。如果您不想要那样,请替换ln -scp -r.

sed -ie "s/dark/light/" ~/file
Run Code Online (Sandbox Code Playgroud)

表示darklight~/file 中的全部替换。

sed -ie "s/Comment=.*$/Comment=Created with by me/" ~/.icons/super-mono/index.theme
Run Code Online (Sandbox Code Playgroud)

.*$任何文本 (.*) 匹配到行尾 ($) 的方法。

sed -ie "s/Inherits=/Inherits=ubuntu-mono-dark,/"   ~/.icons/super-mono/index.theme
Run Code Online (Sandbox Code Playgroud)

在这里,我们将 ubuntu-mono-dark 插入 Inherits 列表的前面,因为我们正在寻找Inherits=并将其替换为Inherits=ubuntu-mono-dark,

在我使用的任何地方sed,您都可以编辑文件并手动应用编辑。

  • <sarcasm>我不确定这篇文章是否足够详细 pydave</sarcasm> 严肃地说,很好的答案。我实际上有一个与 Clementines 图标类似的问题,这个问题已经解决了。 (2认同)

Val*_*ery 4

使用您最喜欢的文本编辑器编辑下面的文件

/usr/share/icons/ubuntu-mono-(which mono set you want)/index.theme

并将 Faenza 放在继承行的开头。

  • 您应该避免修改系统文件。ubuntu-mono 的更新将恢复您的更改。 (5认同)