From 3641afc8bf865de75a8fbd6266c82c4a3196bcf2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 9 Aug 2019 15:26:43 +1000 Subject: [PATCH] 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 --- tuhi-gui.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tuhi-gui.in b/tuhi-gui.in index b5786f3..b64edf2 100755 --- a/tuhi-gui.in +++ b/tuhi-gui.in @@ -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.load_from_data(css) Gtk.StyleContext.add_provider_for_screen( - Gdk.Screen.get_default(), + screen, style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION )