From 219dc9c02e62bc56f22a4f3fddf5b5278411e0c9 Mon Sep 17 00:00:00 2001
From: gfdgd-xi <3025613752@qq.com>
Date: Mon, 26 Jun 2023 14:54:05 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BE=E6=A0=87=E5=92=8C?=
 =?UTF-8?q?=E5=8F=B3=E9=94=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 gx-env-load-desktop-in-chroot | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gx-env-load-desktop-in-chroot b/gx-env-load-desktop-in-chroot
index 7434143..f209f6e 100644
--- a/gx-env-load-desktop-in-chroot
+++ b/gx-env-load-desktop-in-chroot
@@ -28,8 +28,22 @@ for i in os.listdir("{}/usr/share/applications".format(chrootEnvPath)):
         if "exec=" in r.lower():
             #newInfo += "Exec=gx-env-run " + r[5:].strip() + "\n"
             with open("/gx-env/shell/gx-env-{}.sh".format(os.path.splitext(os.path.basename(i))[0]), "w") as file:
-                file.write("#!/bin/bash\n" + r[5:].strip().replace("%F", "").replace("%f", "").replace("%u", "").replace("%U", ""))
-            newInfo += "Exec=gx-env-run bash \"/gx-env/shell/gx-env-{}.sh\"\n".format(os.path.splitext(os.path.basename(i))[0])
+                program = r[5:].strip()
+                command = ""
+                if "%F" in program:
+                    program = program.replace("%F", "$1")
+                    command += " %F "
+                if "%f" in program:
+                    program = program.replace("%f", "$2")
+                    command += " %f "
+                if "%u" in program:
+                    program = program.replace("%u", "$3")
+                    command += " %u "
+                if "%U" in program:
+                    program = program.replace("%U", "$4")
+                    command += " %U "
+                file.write("#!/bin/bash\n" + program)
+            newInfo += "Exec=gx-env-run bash \"/gx-env/shell/gx-env-{}.sh\" {} \n".format(os.path.splitext(os.path.basename(i))[0], command)
         elif "name=" in r.lower() or "name[" in r.lower():
             newInfo += r + "(兼容模式)\n"
         elif "icon=" in r.lower():