qutebrowser: Make xdg-utils optional
Replace all hard-coded instances of using xdg-open with at least one non-xdg alternative. Mostly falling back to either mimeo or a custom open script.
This commit is contained in:
parent
ff2ae79878
commit
d69a0f40e1
5 changed files with 41 additions and 8 deletions
|
|
@ -21,6 +21,7 @@
|
|||
# continue surfing like normal, only that you can now also access
|
||||
# any gemini pages as if they were part of the normal http protocol.
|
||||
|
||||
import shutil
|
||||
import cgi
|
||||
import html
|
||||
import os
|
||||
|
|
@ -379,7 +380,10 @@ def open_url(url: str, open_args: str) -> None:
|
|||
with open(fifo, "w") as qfifo:
|
||||
qfifo.write(f"open {open_args} {to_open}")
|
||||
return
|
||||
os.system(f"xdg-open {to_open}")
|
||||
if shutil.which("mimeo"):
|
||||
_ = os.system(f"mimeo {to_open}")
|
||||
elif shutil.which("xdg-open"):
|
||||
_ = os.system(f"xdg-open {to_open}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue