- desktop_file_path = args.host_user + \
- "/.local/share/applications/Waydroid.desktop"
- if os.path.isfile(desktop_file_path):
- os.remove(desktop_file_path)
- lines = ["[Desktop Entry]", "Type=Application"]
- lines.append("Name=Waydroid")
- lines.append("Exec=waydroid show-full-ui")
- if hide:
- lines.append("NoDisplay=true")
- lines.append("Icon=" + tools.config.tools_src + "/data/AppIcon.png")
- desktop_file = open(desktop_file_path, "w")
- for line in lines:
- desktop_file.write(line + "\n")
- desktop_file.close()
- os.chmod(desktop_file_path, 0o755)
+ desktop_file_path = apps_dir + "/Waydroid.desktop"
+ # 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;
+X-Purism-FormFactor=Workstation;Mobile;
+Icon=waydroid
+NoDisplay={str(hide).lower()}
+""")