#!/usr/bin/env python # vim: ft=python import os fixes = [] with open(os.environ["XDG_CONFIG_HOME"] + "/xournal_conf/ugly_fix", "r") as f: fixes = f.read().strip().split("\n") with open(os.environ["XDG_CONFIG_HOME"] + "/xournalpp/settings.xml", "r") as f: text = f.read().strip().split("\n") for i in range(len(text)): if "selectionBorderColor" in text[i]: text[i] = '<property name="selectionBorderColor" value="' + str(int('FF' + fixes[1], 16)) + '"/>' if "backgroundColor" in text[i] and "pageTemplate" not in text[i]: text[i] = '<property name="backgroundColor" value="' + str(int('FF' + fixes[2], 16)) + '"/>' if "selectionMarkerColor" in text[i]: text[i] = '<property name="selectionMarkerColor" value="' + str(int('FF' + fixes[3], 16)) + '"/>' if "pageTemplate" in text[i]: text[i] = '<property name="pageTemplate" value="xoj/template copyLastPageSize=false copyLastPageSettings=false size=611.999983x791.999983 backgroundType=graph backgroundColor=#ff' + fixes[0] + ' "/>' if "defaultViewModeAttributes" in text[i]: text[i] = '<property name="defaultViewModeAttributes" value="showMenubar,showToolbar"/>' text = "\n".join(text) with open(os.environ["XDG_CONFIG_HOME"] + "/xournalpp/settings.xml", "w") as f: f.write(text)