gui: print a warning when we can't connect to the screen
Because the exception thrown is less than obvious. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ee5640b783
commit
3641afc8bf
|
@ -39,10 +39,14 @@ def gtk_style():
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
screen = Gdk.Screen.get_default()
|
||||||
|
if screen is None:
|
||||||
|
print('Error: Unable to connect to screen. Make sure DISPLAY or WAYLAND_DISPLAY are set', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
style_provider = Gtk.CssProvider()
|
style_provider = Gtk.CssProvider()
|
||||||
style_provider.load_from_data(css)
|
style_provider.load_from_data(css)
|
||||||
Gtk.StyleContext.add_provider_for_screen(
|
Gtk.StyleContext.add_provider_for_screen(
|
||||||
Gdk.Screen.get_default(),
|
screen,
|
||||||
style_provider,
|
style_provider,
|
||||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue