当我从终端启动 okular 时,我收到一堆关于某些图标主题文件夹的“Invalid Context”警告(都来自 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/"
似乎(如here和here所述)某些图标主题(在您的情况下是Yaru和Adwaita)没有指定所有上下文。
我发现使用 Okular 摆脱这些警告消息的最简单解决方案是使用另一个图标主题,例如,在 Ubuntu 中使用氧气图标主题。
从终端安装oxygen-icon-theme:
然后,转到 Tweaks 并在 Appearance 菜单中将 Icons 选项更改为 Oxygen。
手动删除这个烦人的列表:
使用方便的文本编辑器打开
/usr/share/icons/Adwaita/index.theme
并用“Action”查找/替换“Legacy”和“UI”。当心那些是区分大小写的。由于大小写错误(Stock vs stock),mono-dark 也有类似的错误
Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/22/"
Legacy 和 UI 不是有效的上下文,但规范只提到了 4 个,而还有几个在使用中。(谁能提供一份清单?)
我没有注意到任何不利影响。
对于一种简单的解决方法,可以重定向输出错误消息。要使其永久化,请为 okular 命令定义一个别名。例如,使用 bash: