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,6 +3058,7 @@ class ChicagoPlus:
self.get_font_list()
if 'nonclientmetrics' in self.theme_config:
try:
xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip()
self.logger.debug("Getting DPI")
args = [
@ -3067,6 +3068,10 @@ class ChicagoPlus:
]
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']:
if isinstance(self.theme_config['nonclientmetrics'][logfont], dict) and 'lfFaceName[32]' in self.theme_config['nonclientmetrics'][logfont]:
@ -3123,6 +3128,7 @@ class ChicagoPlus:
## Enable Helper functions
def xfconf_query(self, channel, prop, new_value):
try:
xfconf_query_path = subprocess.check_output(["which", "xfconf-query"]).strip()
self.logger.debug("Changing xfconf setting {}/{} to {}".format(channel, prop, new_value))
args = [
@ -3132,7 +3138,8 @@ class ChicagoPlus:
"--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()