Skip to content

Commit

Permalink
Add: XDGViewer which uses xdg-open
Browse files Browse the repository at this point in the history
Synopsis

xdg-open { file | URL }

xdg-open { --help | --manual | --version }

Use 'man xdg-open' or 'xdg-open --manual' for additional info.
  • Loading branch information
m-shinder committed Dec 20, 2021
1 parent 591e79e commit 5cca90a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/PIL/ImageShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ def show_file(self, file, **options):
return 1


class XDGViewer(UnixViewer):
"""
The freedesktop.org ``xdg-open`` command.
"""

def get_command_ex(self, file, **options):
command = executable = "xdg-open"
return command, executable


class DisplayViewer(UnixViewer):
"""
The ImageMagick ``display`` command.
Expand Down Expand Up @@ -233,6 +243,8 @@ def get_command_ex(self, file, title=None, **options):


if sys.platform not in ("win32", "darwin"): # unixoids
if shutil.which("xdg-open"):
register(XDGViewer)
if shutil.which("display"):
register(DisplayViewer)
if shutil.which("gm"):
Expand Down

0 comments on commit 5cca90a

Please sign in to comment.