From a4c02f2fd6276c9111e9653a4857a2dbce3a605e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 2 May 2022 10:22:20 +0200 Subject: [PATCH] Support flatpak build Use 3 levels for application ID. Use XDG_RUNTIME_DIR as TMPDIR to share file outside the sandbox issue11250 review390051002 --- bin/tryton | 5 +++++ tryton/client.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/tryton b/bin/tryton index f44c845ad5..4f206a8faf 100755 --- a/bin/tryton +++ b/bin/tryton @@ -41,6 +41,11 @@ if hasattr(sys, 'frozen'): if sys.platform == 'darwin': sys.argv = [a for a in sys.argv if not a.startswith('-psn_')] +if os.environ.get('FLATPAK_ID') and os.environ.get('XDG_RUNTIME_DIR'): + # Set $TMPDIR to share files outside the sandbox + os.environ['TMPDIR'] = os.path.join( + os.environ.get('XDG_RUNTIME_DIR'), 'app', os.environ.get('FLATPAK_ID')) + # Disable dbusmenu to show second menu in tabs os.environ['UBUNTU_MENUPROXY'] = '0' diff --git a/tryton/client.py b/tryton/client.py index 25a7a9809d..d2ccd96ccd 100644 --- a/tryton/client.py +++ b/tryton/client.py @@ -78,7 +78,7 @@ def main(): 'database': CONFIG['login.db'], } server = hashlib.md5(server.encode('utf-8')).hexdigest() - application_id = 'org.tryton._' + server + application_id = 'org.tryton.Tryton._' + server app = gui.Main( application_id=application_id, flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)