X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/1f0393876d891d0e32a995d0bf7259cc6505afdc..15bbf62e43e8e2482aab809d24153fcbfc83a7bf:/tools/services/user_manager.py diff --git a/tools/services/user_manager.py b/tools/services/user_manager.py index 41fea83..b8771e7 100644 --- a/tools/services/user_manager.py +++ b/tools/services/user_manager.py @@ -8,7 +8,7 @@ from tools.interfaces import IUserMonitor from tools.interfaces import IPlatform -def start(args): +def start(args, unlocked_cb=None): def makeDesktopFile(appInfo): showApp = False for cat in appInfo["categories"]: @@ -20,7 +20,7 @@ def start(args): packageName = appInfo["packageName"] desktop_file_path = args.host_user + \ - "/.local/share/applications/" + packageName + ".desktop" + "/.local/share/applications/waydroid." + packageName + ".desktop" if not os.path.exists(desktop_file_path): lines = ["[Desktop Entry]", "Type=Application"] lines.append("Name=" + appInfo["name"]) @@ -33,19 +33,22 @@ def start(args): os.chmod(desktop_file_path, 0o755) return 0 - def makeWaydroidDesktopFile(): + def makeWaydroidDesktopFile(hide): desktop_file_path = args.host_user + \ "/.local/share/applications/Waydroid.desktop" - if not os.path.exists(desktop_file_path): - lines = ["[Desktop Entry]", "Type=Application"] - lines.append("Name=Waydroid") - lines.append("Exec=waydroid show-full-ui") - 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) + 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) def userUnlocked(uid): logging.info("Android with user {} is ready".format(uid)) @@ -60,12 +63,11 @@ def start(args): makeDesktopFile(app) multiwin = platformService.getprop("persist.waydroid.multi_windows", "false") if multiwin == "false": - makeWaydroidDesktopFile() + makeWaydroidDesktopFile(False) else: - desktop_file_path = args.host_user + \ - "/.local/share/applications/Waydroid.desktop" - if os.path.isfile(desktop_file_path): - os.remove(desktop_file_path) + makeWaydroidDesktopFile(True) + if unlocked_cb: + unlocked_cb(args) def packageStateChanged(mode, packageName, uid): platformService = IPlatform.get_service(args)