如何更改 20.04 默认微调器

use*_*495 5 icons icon-themes 20.04

在此处输入图片说明

请注意文本“Thunderbird Mail”旁边的微调器。我更换了微调图标

usr > share > icons > Yaru

scalable-max-32 > status

并在

scalable > status

两个图标都有名字 process-working-symbolic

即使在那之后,我到处都能买到这个旧的纺纱机。是否可以将其更改为我们选择的图标。? 谢谢。

UnK*_*OWn 4

相关图像的路径被硬编码为,'resource:///org/gnome/shell/theme/process-working.svg'并且来自.gresource正在使用的文件。

对于登录屏幕和桌面会话,此资源文件可能不同。

假设您使用的是默认 Ubuntu 20.04

您需要process-working.svg.gresource文件中编辑/替换该文件。

默认 Ubuntu 20.04/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource文件是要编辑的文件。

我已经完成了这个过程,并process-working.svg用一些 .svg 替换了文件,然后陷入了登录循环。

默认process-working.svg文件是这样的。

在此输入图像描述

它的属性是这样的。

在此输入图像描述

svg 图像似乎有一个技巧,它是具有不同旋转器的单个 svg 图像。所以我用谷歌搜索并得到了一些具有类似 gnome-shell 主题的 512 x 32 像素,并且可以成功更改微调器。

获取/创建 SVG 将花费很多时间..所以我使用了 vanilla gnome 的微调器和默认的 Yaru 的

雅鲁的 在此输入图像描述

香草 GNOME 的 在此输入图像描述

编辑:

为了测试目的,使用 inkspace编辑了原始process-working.svg文件,保留原始尺寸 512 x 32 px,使用 svg 格式并进行测试。

在此输入图像描述

在此输入图像描述

在此输入图像描述

出于自动化目的,可以使用以下脚本。

要求

  1. 首先将您喜欢的 .svg 文件 (512px X 32px) 保存process-working.svg/tmp目录中。
  2. libglib2.0-dev使用以下命令安装软件包

sudo apt install libglib2.0-dev

然后将以下脚本保存在纯文本文件中pwsvg.sh(process-working.svg)

#!/bin/bash

source="/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource"
backup=$source.BAK

pkg=$(dpkg -l | grep libglib2.0-dev >/dev/null && echo "yes" || echo "no")
if [ "$pkg" == "no" ]
then
echo "
-------------------------------------------------------------------------------------------------------------------------------------
Sorry, the package 'libglib2.0-dev' is not installed. Install the package 'sudo apt install libglib2.0-dev' and then run this Script.
For now, Exiting...
-------------------------------------------------------------------------------------------------------------------------------------"
exit 1
fi

cd /tmp

if ! [ -f "process-working.svg" ]
then
echo "-----your preferred .svg file 'process-working.svg' not found in /tmp folder. put the process-working.svg file in /tmp directory first.-----"
exit
fi

if [ "$UID" != "0" ]
then
echo "This Script must be run with sudo"
exit 1
fi

# take backup of original resource file
if ! [ -f $backup ]
then
cp $source $backup;
fi

for a in $(gresource list $backup); do
    b="${a/#\/org\/gnome\/shell\/}"
    mkdir -p $(dirname $b)
    gresource extract $backup $a > $b
done

mv -f process-working.svg ./theme/

FILES=$(find "theme" -type f -printf "%P\n" | xargs -i echo "    <file>{}</file>")

cat <<EOF >"theme/gnome-shell-theme.gresource.xml"
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gnome/shell/theme">
$FILES
  </gresource>
</gresources>
EOF

cd theme
glib-compile-resources gnome-shell-theme.gresource.xml
mv -f gnome-shell-theme.gresource $source
echo " Reboot to see the changes "
Run Code Online (Sandbox Code Playgroud)

运行命令sudo bash pwsvg.sh并重新启动。

如果出现任何问题,请从任何 tty 将已编辑的 gresource 文件替换为备份文件/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource.BAK

sudo mv /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource.BAK /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
Run Code Online (Sandbox Code Playgroud)

在 Ubuntu 20.04.2 中测试

  • **+1** 这个答案直接切中要点。 (2认同)