]> glassweightruler.freedombox.rocks Git - waydroid.git/blobdiff - tools/services/user_manager.py
net: Add "waydroid adb connect" action
[waydroid.git] / tools / services / user_manager.py
index 92ee203b688eac7f5dc20b6a1aac5fc5e01f642f..9ab546a7ec6668d20767f8df19958e88d249b7c6 100644 (file)
@@ -49,15 +49,19 @@ 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
 Exec=waydroid show-full-ui
-Categories=X-WayDroid-App;
+Categories=X-WayDroid-App;Utility;
 X-Purism-FormFactor=Workstation;Mobile;
 Icon=waydroid
 NoDisplay={str(hide).lower()}
@@ -68,7 +72,10 @@ NoDisplay={str(hide).lower()}
         logging.info("Android with user {} is ready".format(uid))
 
         if cfg["waydroid"]["auto_adb"] == "True":
-            tools.helpers.net.adb_connect(args)
+            try:
+                tools.helpers.net.adb_connect(args)
+            except:
+                pass
 
         platformService = IPlatform.get_service(args)
         if platformService: