每次我打开 gtk 应用程序时,它都会输出 css 警告(缺少假设 px 等的单位)。我可以禁用这种可怕的冗长内容吗?
例子:
$ gedit
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:3:14: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:52:20: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:72:19: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:102:14: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:102:16: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:105:20: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:129:16: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:130:17: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:141:20: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:142:19: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:149:14: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:168:19: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:169:20: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:182:19: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:196:20: Not using units is deprecated. Assuming 'px'.
(gedit:19558): Gtk-WARNING **: Theme parsing error: gtk-widgets.css:207:19: Not using units is deprecated. Assuming 'px'.
答案1
我不确定是否还有其他人遇到这个问题,但我肯定遇到了。解决方案非常简单。
我在 Arch Linux 上运行 xfce4,使用“dusk theme”。我在 gtk.css 文件的第 72 行遇到了此错误。
通过对“find”的输出进行 grep,我找到了该文件/usr/share/themes/Xfce-dusk/gtk-3.0/gtk.css
。
在第 72 行我将其改为:
"text-shadow: 1 1 white;"
到
"text-shadow: 1px 1px white;"
瞧!再也没有烦人的错误信息了!
答案2
好吧,我通常通过将 stderr 重定向到 /dev/null 来解决这个问题
gapp 2>/dev/null
另外,尝试一下选项--gtk-no-debug all