Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python3
- import pathlib
- def fcopy(src, dst):
- f1 = open(src, "r")
- f2 = open(dst, "w")
- f2.write(f1.read())
- f1.close()
- f2.close()
- homedir = str(pathlib.Path.home())
- pywal_conf = open(homedir + "/.cache/wal/colors", "r")
- colors_str = str(pywal_conf.read())
- pywal_conf.close()
- color_list = colors_str.splitlines()
- total = len(color_list)
- fcopy(homedir + "/.config/xfce4/terminal/terminalrc", homedir + "/.config/xfce4/terminal/terminalrc.bak")
- xfce_conf = open(homedir + "/.config/xfce4/terminal/terminalrc", "r")
- content = xfce_conf.read()
- xfce_conf.close()
- xfce_conf = open(homedir + "/.config/xfce4/terminal/terminalrc", "w+")
- new_palette = "ColorPalette=" + ";".join(color_list) #trim the last 2 colors since they're BG and FG
- lines = content.splitlines()
- for i in range(len(lines)):
- if (lines[i][:len("ColorPalette")] == "ColorPalette"):
- lines[i] = new_palette
- elif (lines[i][:len("ColorForeground=")] == "ColorForeground="):
- lines[i] = "ColorForeground=" + color_list[len(color_list)-1]
- elif (lines[i][:len("ColorBackground=")] == "ColorBackground="):
- lines[i] = "ColorBackground=" + color_list[0]
- new_conf = "\n".join(lines)
- xfce_conf.write(new_conf)
- xfce_conf.close()
- print("Done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement