diff --git a/xion/xfconf.py b/xion/xfconf.py index 84a8319..4e1ee0c 100644 --- a/xion/xfconf.py +++ b/xion/xfconf.py @@ -80,14 +80,12 @@ class Xfconf: prop_type = Xfconf.convert_type(prop_type) if not prop_type: return False - value = Xfconf.sanitize_str(value) output = self.xq(["-c", channel, "-p", prop, "-n", "-t", prop_type, "-s", value]) return output == "" def update_property(self, channel, prop, value): """Update an existing property, return True on success.""" - value = Xfconf.sanitize_str(value) output = self.xq(["-c", channel, "-p", prop, "-s", value]) return output == "" @@ -102,7 +100,7 @@ class Xfconf: subtype = Xfconf.convert_type(value["type"]) if not subtype: return False - subvalue = Xfconf.sanitize_str(value["value"]) + subvalue = value["value"] command += ["-t", subtype, "-s", subvalue] output = self.xq(command) return output == "" @@ -129,14 +127,6 @@ class Xfconf: print(f"Unknown gtype {gtype}.") return xq_type - @staticmethod - def sanitize_str(value): - """Wrap value with doublequotes if it contains whitespaces.""" - for char in string.whitespace: - if char in value: - return f'"{value}"' - return value - XION_PROP_RE = re.compile(r"t:(\S+) (.+)") diff --git a/xion/xion.py b/xion/xion.py index 8f331ec..9ba01cd 100644 --- a/xion/xion.py +++ b/xion/xion.py @@ -67,9 +67,10 @@ class Xion: if confirm and input("Confirm? [y/N]") != "y": print("Operation cancelled.") return False - if replace and not self.clear_tree(channel, root): - print("Failed to clear properties.") - return False + if replace: + if not self.clear_tree(channel, root): + print("Failed to clear properties.") + return False for prop, content in tree.items(): if not self.apply_property(channel, prop, content): print(f"Failed to apply property {prop}.")