覆盖 GTK 中 gnome-settings-daemon 的主题设置
在 pygtk 应用程序中,我使用 rc_parse_string 来调整 GUI 的外观。 (主要是为了使其在 Windows 下看起来更原生,并为各个小部件提供主题。)例如,这将更改我的应用程序的图标主题:
gtk.rc_parse_string("""
gtk-icon-theme-name = "Galaxy"
""")
这适用于 Windows,但仅当 gnome-settings-daemon 为 Linux 时才适用没有运行。如何覆盖 gnome-settings-daemon 所做的主题设置? (仅在我的应用程序中,无需更改系统范围的设置!)
(顺便说一句,当您尝试通过设置 GTK2_RC_FILES 来主题化单个应用程序时,会发生同样的问题。它适用于非本机应用程序,例如OpenOffice,但一旦设置守护程序运行,本机 gnome 应用程序就会失败。)
In a pygtk app, I'm using rc_parse_string to adjust the appearance of my GUI. (Mostly to make it look more native under Windows, and to theme individual widgets.) This, for example, would change the icon theme for my application:
gtk.rc_parse_string("""
gtk-icon-theme-name = "Galaxy"
""")
This works under Windows, but it only works under Linux when gnome-settings-daemon is not running. How do I override the theme settings made by gnome-settings-daemon? (In my application only, without changing system-wide settings!)
(By the way, the same problem occurs when you try to theme an individual app by setting GTK2_RC_FILES
. It works for non-native apps like OpenOffice, but fails for native gnome apps as soon as the settings daemon is running.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终找到了该怎么做。要覆盖图标主题:
GtkSettings 文档<中有一个所有可能设置的列表< /a>.
如果要将图标主题与应用程序打包,请在更改属性之前将脚本目录添加到图标搜索路径:
I eventually found out how to do it. To override the icon theme:
There is a list of all possible settings in the GtkSettings documentation.
If you want to package the icon theme with your application, add the script directory to the icon search path before changing the property: