Skip to content

Commit

Permalink
Add support for Meld flatpak
Browse files Browse the repository at this point in the history
  • Loading branch information
xalt7x committed May 23, 2024
1 parent 16d36dd commit 66d4849
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 66d4849

Please sign in to comment.