From 3c7dd56bb7182ccbc44227e88fc0f5ba27fd1e5f Mon Sep 17 00:00:00 2001 From: grassmunk Date: Thu, 14 Jan 2021 20:35:28 -0800 Subject: [PATCH] fixing xfconf checks to fail gracefully --- Plus/pluslib.py | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/Plus/pluslib.py b/Plus/pluslib.py index 2a4219a..6c504a5 100644 --- a/Plus/pluslib.py +++ b/Plus/pluslib.py @@ -3058,14 +3058,19 @@ class ChicagoPlus: self.get_font_list() if 'nonclientmetrics' in self.theme_config: - xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip() - self.logger.debug("Getting DPI") - args = [ - xfconf_query_path, - "-v", '-l', '-c', 'xsettings', - "-p", '/Xft/DPI' - ] - dpi = subprocess.check_output(args).split()[1] + try: + xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip() + self.logger.debug("Getting DPI") + args = [ + xfconf_query_path, + "-v", '-l', '-c', 'xsettings', + "-p", '/Xft/DPI' + ] + dpi = subprocess.check_output(args).split()[1] + + except subprocess.CalledProcessError: + self.logger.info("xfconf not installed, enable theme manually") + return self.logger.debug("Getting MenuFont and CaptionFont") for logfont in ['lfcaptionfont', 'lfMenuFont']: @@ -3123,16 +3128,18 @@ class ChicagoPlus: ## Enable Helper functions def xfconf_query(self, channel, prop, new_value): - xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip() - self.logger.debug("Changing xfconf setting {}/{} to {}".format(channel, prop, new_value)) - args = [ - xfconf_query_path, - "--channel", channel, - "--property", prop, - "--set", new_value - ] - subprocess.check_call(args, stdout=subprocess.DEVNULL) - + try: + xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip() + self.logger.debug("Changing xfconf setting {}/{} to {}".format(channel, prop, new_value)) + args = [ + xfconf_query_path, + "--channel", channel, + "--property", prop, + "--set", new_value + ] + subprocess.check_call(args, stdout=subprocess.DEVNULL) + except subprocess.CalledProcessError: + self.logger.info("xfconf not installed, enable theme manually") def get_font_list(self): fc_list = subprocess.check_output(["which", "fc-list"]).strip()