fixing xfconf checks to fail gracefully

This commit is contained in:
grassmunk 2021-01-14 20:35:28 -08:00
parent 8fe09c856e
commit 3c7dd56bb7

View File

@ -3058,14 +3058,19 @@ class ChicagoPlus:
self.get_font_list() self.get_font_list()
if 'nonclientmetrics' in self.theme_config: if 'nonclientmetrics' in self.theme_config:
xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip() try:
self.logger.debug("Getting DPI") xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip()
args = [ self.logger.debug("Getting DPI")
xfconf_query_path, args = [
"-v", '-l', '-c', 'xsettings', xfconf_query_path,
"-p", '/Xft/DPI' "-v", '-l', '-c', 'xsettings',
] "-p", '/Xft/DPI'
dpi = subprocess.check_output(args).split()[1] ]
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") self.logger.debug("Getting MenuFont and CaptionFont")
for logfont in ['lfcaptionfont', 'lfMenuFont']: for logfont in ['lfcaptionfont', 'lfMenuFont']:
@ -3123,16 +3128,18 @@ class ChicagoPlus:
## Enable Helper functions ## Enable Helper functions
def xfconf_query(self, channel, prop, new_value): def xfconf_query(self, channel, prop, new_value):
xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip() try:
self.logger.debug("Changing xfconf setting {}/{} to {}".format(channel, prop, new_value)) xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip()
args = [ self.logger.debug("Changing xfconf setting {}/{} to {}".format(channel, prop, new_value))
xfconf_query_path, args = [
"--channel", channel, xfconf_query_path,
"--property", prop, "--channel", channel,
"--set", new_value "--property", prop,
] "--set", new_value
subprocess.check_call(args, stdout=subprocess.DEVNULL) ]
subprocess.check_call(args, stdout=subprocess.DEVNULL)
except subprocess.CalledProcessError:
self.logger.info("xfconf not installed, enable theme manually")
def get_font_list(self): def get_font_list(self):
fc_list = subprocess.check_output(["which", "fc-list"]).strip() fc_list = subprocess.check_output(["which", "fc-list"]).strip()