From: Jeremy Bicha <jeremy.bicha@canonical.com>
Date: Thu, 17 Feb 2022 09:20:10 -0500
Subject: Support GNOME 42 dark style preference

Adds an optional dependency on libhandy >= 1.5

https://github.com/OpenPrinting/system-config-printer/pull/263
---
 system-config-printer.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/system-config-printer.py b/system-config-printer.py
index f3e2663..698d177 100755
--- a/system-config-printer.py
+++ b/system-config-printer.py
@@ -47,6 +47,16 @@ except RuntimeError as e:
     print ("This is a graphical application and requires DISPLAY to be set.")
     sys.exit (1)
 
+# Optional dependency, requires libhandy >= 1.5
+gi.require_version('Handy', '1')
+try:
+    from gi.repository import Handy
+    Handy.init()
+    # Support GNOME 42 dark mode
+    Handy.StyleManager.get_default().set_color_scheme(Handy.ColorScheme.PREFER_LIGHT)
+except:
+    pass
+
 def show_help():
     print ("\nThis is system-config-printer, " \
            "a CUPS server configuration program.\n\n"
