Skip to content

Commit

Permalink
Merge pull request #1 from xalt7x/add-flatpak-fallback
Browse files Browse the repository at this point in the history
Add support for Meld flatpak
  • Loading branch information
weshouman authored Aug 8, 2024
2 parents 16d36dd + 66d4849 commit 4e65290
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion data/meld_compare.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
from gi.repository import Nautilus, GObject

class MeldExtension(GObject.GObject, Nautilus.MenuProvider):
Expand All @@ -8,7 +9,13 @@ def __init__(self):
self.left_dir = None

def menu_activate_cb(self, menu, file1, file2):
os.system(f"meld \"{file1}\" \"{file2}\" &")
try:
outp = subprocess.check_output(["which", "meld"])
os.system(f"meld \"{file1}\" \"{file2}\" &")
except Exception as _ex:
print("cannot find meld")
# fallback to flatpak
os.system(f"flatpak run org.gnome.meld \"{file1}\" \"{file2}\" &")

def set_left_cb(self, menu, file, is_directory):
if is_directory:
Expand Down

0 comments on commit 4e65290

Please sign in to comment.