From 66d48491d191885dfc9e14fad61444d52a210a17 Mon Sep 17 00:00:00 2001 From: Yevhen Popok Date: Thu, 23 May 2024 18:42:00 +0300 Subject: [PATCH] Add support for Meld flatpak Use Meld flatpak as a fallback. Credits: https://gitlab.gnome.org/philippun1/snoop/-/commit/09c05782551a00577564bfaecd0bd8fef6de0a69 --- data/meld_compare.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/data/meld_compare.py b/data/meld_compare.py index 0e1c840..8227830 100644 --- a/data/meld_compare.py +++ b/data/meld_compare.py @@ -1,4 +1,5 @@ import os +import subprocess from gi.repository import Nautilus, GObject class MeldExtension(GObject.GObject, Nautilus.MenuProvider): @@ -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: