Auto run GTK app on Colibri iMX6ULL using yocto

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

To automatically launch your GTK application on a Colibri iMX6ULL using Yocto, you can utilize the systemd service manager, which is part of the Toradex Linux BSP. Here’s a general approach:

  1. Create a Systemd Service File: This file will define how your application should be started. Create a file with a .service extension, for example, myapp.service, and place it in /etc/systemd/system/.

    Example content for myapp.service:

    [Unit]
    Description=Start My GTK Application
    After=weston.service
    
    [Service]
    ExecStart=/path/to/your/gtk/application
    Environment="XDG_RUNTIME_DIR=/run/user/1000"
    Environment="DISPLAY=:0"
    
    [Install]
    WantedBy=multi-user.target
    

    Ensure that the ExecStart path points to your GTK application.

  2. Enable the Service: Use the systemctl command to enable your service so that it starts on boot:

    sudo systemctl enable myapp.service
    sudo systemctl start myapp.service
    
  3. Using wayland-app-launch: If you prefer to use wayland-app-launch, you can modify the ExecStart line in your service file to include it. For example:

    ExecStart=/usr/bin/wayland-app-launch /path/to/your/gtk/application
    

    This assumes that wayland-app-launch is available in your environment and that your application is compatible with Wayland.

This setup should help you automatically start your GTK application on boot. If you have any further questions about integrating wayland-app-launch, feel free to ask!

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

Autostart GTK application after boot.