diff --git a/cfg/general_config.cfg b/cfg/general_config.cfg index f349c22..b288cce 100644 --- a/cfg/general_config.cfg +++ b/cfg/general_config.cfg @@ -44,3 +44,6 @@ ARXIV_RSS_URL="https://rss.arxiv.org/atom/astro-ph" ADSABS_QUERY_URL="https://api.adsabs.harvard.edu/v1/search/query?" ADSABS_EXPORT_URL="https://api.adsabs.harvard.edu/v1/export/bibtexabs/" + +OPT_PDF_READER="/bin/flatpak run com.github.ahrm.sioyek" +OPT_TXT_EDITOR="nvim" diff --git a/src/utils.py b/src/utils.py index 56f4db4..7e62681 100644 --- a/src/utils.py +++ b/src/utils.py @@ -45,6 +45,9 @@ FILTERS_DIR = os.environ.get("FILTERS_DIR") DB_DIR = os.environ.get("DB_DIR") PDF_DIR = os.environ.get("PDF_DIR") +OPT_PDF_READER = os.environ.get("OPT_PDF_READER") +OPT_TXT_EDITOR = os.environ.get("OPT_TXT_EDITOR") + COLOUR_DEFAULT = "\033[0m" COLOUR_INPUT = "\033[36m" COLOUR_OUTPUT = "\033[32m" @@ -404,7 +407,8 @@ def arxtic_comment(key, library): comment = block["arxtic_comment"] with open("comment.tmp", "w+") as file: file.write(comment) - subprocess.run(["nvim", "-c", "set syntax=markdown", "-c", "set cc=", "comment.tmp"]) + subprocess.run(OPT_TXT_EDITOR.split(" ") + ["-c", "set syntax=markdown", + "-c", "set cc=", "comment.tmp"]) with open("comment.tmp", "r") as file: comment = "".join(file.readlines()) subprocess.run(["rm", "comment.tmp"]) @@ -489,6 +493,6 @@ def arxtic_filename(key, library, filename): def launch_reader(key, library, directory=PDF_DIR): block = find(key, library) fname = block["arxtic_filename"] - subprocess.Popen(["/bin/flatpak", "run", "com.github.ahrm.sioyek", directory+fname], + subprocess.Popen(OPT_PDF_READER.split(" ") + [directory+fname], stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL)