Page 1 of 1

Waydroid app launch

Posted: Wed Mar 25, 2026 2:44 am
by Crombie
Im using some of the coding from
To create a menu button for a android app launched with waydroid. I have successfully created the menu and it launches the app. But when I go to access other areas of hudiy the android app looses focus and I cant bring it back to the front.

Is there a better solution?

The code i am using is

Code: Select all

from flask import Flask
import subprocess
import os

app = Flask(__name__)

def run_game(cmd):
    env = os.environ.copy()

    # Required for Waydroid / GUI apps
    env["DISPLAY"] = os.environ.get("DISPLAY", ":0")
    env["WAYLAND_DISPLAY"] = os.environ.get("WAYLAND_DISPLAY", "wayland-0")
    env["XDG_RUNTIME_DIR"] = os.environ.get("XDG_RUNTIME_DIR", f"/run/user/{os.getuid()}")

    # Optional
    env["DBUS_SESSION_BUS_ADDRESS"] = os.environ.get("DBUS_SESSION_BUS_ADDRESS", "")

    subprocess.Popen(cmd, env=env)

# apps
@app.route("/draiver")
def draiver():
    run_game(["waydroid", "app", "launch", "com.driverdo"])
    return "Draiver launched!", 200

# flask
if __name__ == "__main__":
    app.run(host="0.0.0.0", port=44408)

Re: Waydroid app launch

Posted: Wed Mar 25, 2026 10:52 am
by hudiy
You can try using wlrctl (sudo apt install wlrctl) to bring the window to the front.

In your script (in /draiver), you can check if your application is already running (e.g., if it appears on the list returned by wlrctl toplevel list), and if so, call:

wlrctl toplevel focus app_id:your_app_name

and if not, simply launch it.

https://manpages.debian.org/trixie/wlrc ... .1.en.html

Re: Waydroid app launch

Posted: Wed Mar 25, 2026 3:03 pm
by Crombie
Thanks for the reply. It is a option I was looking at but is there a way to do this through some UI changes so that it only displays on screens that i want?

The app i want to launch will always be in a static location and size.

So ideally I would like hudiy UI just to show that area of the desktop. And then change the width of android auto so it doesnt cover that area up as well.