]> glassweightruler.freedombox.rocks Git - waydroid.git/blobdiff - tools/services/user_manager.py
user_manager: Restore desktop-file creation the first time
[waydroid.git] / tools / services / user_manager.py
index 8e7e982ecf3b9e20e004360e2a77fd78816b550b..dbde361536a9ad8cb2a83657e9af350b8d97391a 100644 (file)
@@ -49,10 +49,14 @@ Icon={waydroid_data}/icons/com.android.settings.png
 
     def makeWaydroidDesktopFile(hide):
         desktop_file_path = apps_dir + "/Waydroid.desktop"
-        if os.path.isfile(desktop_file_path):
-            os.remove(desktop_file_path)
-        with open(desktop_file_path, "w") as desktop_file:
-            desktop_file.write(f"""\
+        # If the user has set the desktop file as read-only, we won't replace it
+        if os.path.isfile(desktop_file_path) and not os.access(desktop_file_path, os.W_OK):
+            logging.info(f"Desktop file '{desktop_file_path}' is not writeable, not updating it")
+        else:
+            if os.path.isfile(desktop_file_path):
+                os.remove(desktop_file_path)
+            with open(desktop_file_path, "w") as desktop_file:
+                desktop_file.write(f"""\
 [Desktop Entry]
 Type=Application
 Name=Waydroid
@@ -64,9 +68,11 @@ NoDisplay={str(hide).lower()}
 """)
 
     def userUnlocked(uid):
+        cfg = tools.config.load(args)
         logging.info("Android with user {} is ready".format(uid))
 
-        tools.helpers.net.adb_connect(args)
+        if cfg["waydroid"]["auto_adb"] == "True":
+            tools.helpers.net.adb_connect(args)
 
         platformService = IPlatform.get_service(args)
         if platformService: