Waydroid app launch

Post Reply
Crombie
Posts: 2
Joined: Wed Mar 25, 2026 2:30 am

Waydroid app launch

Post 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)
hudiy
Site Admin
Posts: 515
Joined: Mon Jul 14, 2025 7:42 pm

Re: Waydroid app launch

Post 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
Hudiy Team
Crombie
Posts: 2
Joined: Wed Mar 25, 2026 2:30 am

Re: Waydroid app launch

Post 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.
Attachments
1000018485.jpg
1000018485.jpg (509.12 KiB) Viewed 51 times
Post Reply