Zren / plasma-hud

Provides a way to run menubar commands in KDE Plasma through rofi, much like the Unity 7 Heads-Up Display (HUD).
GNU General Public License v2.0
235 stars 9 forks source link

OpenSUSE error GTK_IS_STYLE_PROVIDER_PRIVATE #20

Open saligari opened 5 years ago

saligari commented 5 years ago

I've tried to install plasma-hud on openSUSE Tumbleweed, I have installed on my system these:

rofi python3 python3-dbus-python python3-setproctitle python3-python-xlib gobject-introspection unity-gtk2-module unity-gtk3-module

I perform the steps of the manual setup, and when I run the script: /usr/lib/plasma-hud/plasma-hud it hangs until I press the hot key to activate it and I get this error (x3) _gtk_style_provider_private_get_settings: assertion GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

Is there something obviously wrong that I'm missing? What could be at fault here?

Thanks!

devillemereuil commented 5 years ago

I can confirm this issue. What is puzzling is that another Tumbleweed install of mine (relatively close in configuration, but things will always differ) does not suffer from this issue.

Tested with a newly created user, just to check, happens for "him" too, so it doesn't seem to stem from a user-related config.

Also, tried to replace unity-gtk-module by appmenu-gtk-module, but to no avail.

Zren commented 5 years ago

I wonder if this has to do with these deprecation warnings I've seen for a while.

(plasma-hud:19288): Gtk-WARNING **: 23:58:33.000: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version
(plasma-hud:19288): Gtk-WARNING **: 23:58:33.000: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version
(plasma-hud:19288): Gtk-WARNING **: 23:58:33.001: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version

Maybe it's the DPI calculation, no clue.

trmdi commented 5 years ago

Oh, it happens even with this HelloWorld example: https://pygobject.readthedocs.io/en/latest/getting_started.html

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

window = Gtk.Window(title="Hello World")
window.show()
window.connect("destroy", Gtk.main_quit)
Gtk.main()

Can you @Zren run this on Manjaro?

Update:

From this: https://gitlab.gnome.org/GNOME/pygobject/issues/298 If I use Gtk.init(), the helloworld code will run well.

Can this be applied?

Zren commented 5 years ago

Does the mate-hud script segfault for you guys too? It might not since it creates a Gtk global shortcut and settings which might call whatever is necessary.

Yep, runs fine. I guess ya'll need me to add Gtk.init() somewhere? Could you try adding it to __main__ in plasma-hud, before DBusGMainLoop?

https://github.com/Zren/plasma-hud/blob/master/usr/lib/plasma-hud/plasma-hud#L609

trmdi commented 5 years ago

Does the mate-hud script segfault for you guys too? It might not since it creates a Gtk global shortcut and settings which might call whatever is necessary.

I haven't tested it but I believe it will crash because of this line: https://github.com/ubuntu-mate/mate-hud/blob/master/usr/lib/mate-hud/mate-hud#L172 as I said above..

You can see this:

Python 3.7.3 (default, Apr 09 2019, 05:18:21) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version("Gtk", "3.0")
>>> from gi.repository import Gtk
>>> Gtk.Window()

(process:5346): Gtk-CRITICAL **: 09:12:00.287: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:5346): Gtk-CRITICAL **: 09:12:00.287: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:5346): Gtk-CRITICAL **: 09:12:00.287: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Segmentation fault (core dumped)

Yep, runs fine. I guess ya'll need me to add Gtk.init() somewhere? Could you try adding it to __main__ in plasma-hud, before DBusGMainLoop?

https://github.com/Zren/plasma-hud/blob/master/usr/lib/plasma-hud/plasma-hud#L609

Yes, that fixes it. And Gtk.init_check() fixes it too. But I don't know what is the difference between these 2 functions. After a quick search, I think these are similar. And that page says:

Call this function (init) before using any other GTK+ functions in your GUI applications.

So I think this is kinda necessary.

Zren commented 5 years ago

Gtk.init_check() is probably the same, but lets the application print some debug/error messages before terminating the app. Maybe it's also designed for allowing the app to retry the init.

I'll toss a Gtk.init() there as it still works for me.

devillemereuil commented 5 years ago

I can confirm this solves the issue for me. Thank you both for tracking down and fixing this issue!