diff --git a/usr/lib/python3/dist-packages/de_control/_common.py b/usr/lib/python3/dist-packages/de_control/_common.py index 3f1aa85..9231f0e 100755 --- a/usr/lib/python3/dist-packages/de_control/_common.py +++ b/usr/lib/python3/dist-packages/de_control/_common.py @@ -24,5 +24,6 @@ """Common internal functions for de_control""" import os + def get_de(): return os.getenv("XDG_CURRENT_DESKTOP").upper() diff --git a/usr/lib/python3/dist-packages/de_control/modify.py b/usr/lib/python3/dist-packages/de_control/modify.py index aaa487f..2c752e5 100644 --- a/usr/lib/python3/dist-packages/de_control/modify.py +++ b/usr/lib/python3/dist-packages/de_control/modify.py @@ -39,17 +39,18 @@ def for_desktop(username): __eprint__("DESKTOP DETECTED. EDITING PANEL ACCORDINGLY.") de = com.get_de() if de == "XFCE": + config = f"/home/{ username }/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" try: os.remove("/home/" + username + "/.config/xfce4/panel/battery-12.rc") except FileNotFoundError: pass - with open("/home/" + username + "/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml", "r") as file: + with open(config, "r") as file: xml = file.read().split("\n") for each in range(len(xml) - 1, -1, -1): if "battery" in xml[each]: del xml[each] xml = "\n".join(xml) - with open("/home/" + username + "/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml", "w") as file: + with open(config, "w") as file: file.write(xml) elif de == "KDE": __eprint__("WARNING: KDE detected. KDE support not yet implemented.")