如何合并两个图标集?

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

我怎么会这样呢?

使用您喜欢的文本编辑器编辑此文件

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

并将法恩扎放在inheritance线的起点。

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

轻量级图标集

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 

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

为了合并我们的两个主题,我们将超级单声道主题改为inheritance自ubuntu-mono-dark和Faenza。

 sed -ie "s/Inherits=.*$/Inherits=ubuntu-mono-dark,Faenza/" ~/.icons/super-mono/index.theme 

对于richzilla来说应该足够了,只需在Appearance中选择super-mono。

添加自定义图标

我们还可以为此图标集添加单个图标:

 ln -s /usr/share/icons/Faenza-Darkest/actions/22/gtk-paste.png ~/.icons/super-mono/actions/22/. 

现在我们的超级单声道主题结合了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不要从任何东西inheritance(所以我们也可以使用法恩莎和小学)。

 # 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 

您会注意到ubuntu-mono-dark图标集现在已损坏。 它将丢失由Humanity-Dark提供的图标以及它inheritance的其他图标集。 此更改只会影响您的用户。

现在我们可以创建一个使用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/. 

这个Faenza-apps图标集也被破坏了。 它只有应用程序的图标。 由于我们删除了Inherits,因此缺少所有其他图标。

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

 # 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 

现在我们应该能够在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/. 

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

 sed -ie "s/dark/light/" ~/file 

用〜/ file替换所有dark light

 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 

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

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