启动某些应用程序时出现有关图标主题的无效上下文警告

启动某些应用程序时出现有关图标主题的无效上下文警告

当我从终端启动 okular 时,我收到一堆关于某些图标主题文件夹的“无效上下文”警告(来自 Yaru,这是 Gnome Tweaks 中的主题设置,以及 Adwaita)。编辑要排除的命名目录的 index.theme 会消除警告,但随后会破坏某些 UI(顶部栏设置中的小箭头变为交叉圆圈禁止图标),我想这是可以预料到的。

谷歌搜索显示,很多人在使用各种应用程序时都遇到过这种情况,但我发现的解决方案并不适用(针对特定应用程序或 Arch)。

Okular 似乎运行良好。我最近从 19.10 升级到了 20.4,但在此之前也存在此错误。

有人知道我为什么会收到这些警告或如何解决它们吗?

完整命令行输出:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/16x16/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/24x24/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/32x32/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/48x48/legacy/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/apps/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/mimetypes/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/scalable/mimetypes/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/8x8/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/16x16/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/16x16/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/24x24/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/24x24/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/32x32/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/32x32/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/48x48/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/48x48/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/64x64/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/64x64/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/96x96/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/96x96/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/256x256/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/512x512/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/scalable/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/scalable/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/16x16/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/24x24/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/32x32/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/48x48/legacy/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/apps/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/mimetypes/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/scalable/mimetypes/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/8x8/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/16x16/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/16x16/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/24x24/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/24x24/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/32x32/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/32x32/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/48x48/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/48x48/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/64x64/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/64x64/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/96x96/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/96x96/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/256x256/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/512x512/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/scalable/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/scalable/ui/"

答案1

似乎(如上所述)这里这里)某些图标主题(在您的例子中是 Yaru 和 Adwaita)没有指定所有上下文。
我发现摆脱 Okular 的这些警告消息的最简单的解决方案是使用另一个图标主题,例如,使用氧气图标主题在 Ubuntu 中。
使用以下命令从终端安装oxygen-icon-theme:

sudo apt update
sudo apt-get install oxygen-icon-theme

然后,转到“调整”并将“外观”菜单中的“图标”选项更改为“氧气”。

答案2

一个简单的解决方法是重定向输出错误消息。要使其永久生效,请为 okular 命令定义一个别名。例如,使用 bash:

alias okular='okular 2> /dev/null'

答案3

手动删除这个烦人的列表的方法:

使用方便的文本编辑器打开/usr/share/icons/Adwaita/index.theme并查找/替换“Legacy”和“UI”以及“Action”。

请注意,这些是区分大小写的。由于大小写错误,mono-dark 中也出现了类似的错误(Stock 与 stock) Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/22/"

Legacy 和 UI 不是有效的上下文,但是规格只提到了 4 个,但实际使用中还有更多。(有人可以提供一个列表吗?)

我没有注意到这有什么有害影响。

相关内容