pyinstantref/pdfref_handler

16 lines
354 B
Plaintext
Raw Normal View History

2023-07-10 17:03:30 -04:00
#!/usr/bin/env python3
# pdfref:// URL handler
import subprocess
from urllib.parse import urlparse, parse_qs
from sys import argv
from datatypes import PageNumber
url = urlparse(argv[1])
query = parse_qs(url.query)
page: PageNumber = PageNumber(int(query.get("page", ["0"])[0]))
subprocess.run(["zathura", "--page", str(page), url.path], text=True)