automatically starting GUI program on startx

891 Views Asked by At

I have GUI code written in PyQt in main.py that I want to start up automatically after startx starts.

I've already configured my beaglebone (Debian) to run startx on power up.

I initially included the following in /etc/x11/xinitrc: @/usr/bin/python3 /root/PyQt/main.py

This worked perfectly until I deleted some files from /root to create space on my beaglebone. I'm not sure what exactly I deleted (mostly log files) but I might have also deleted the .XAuthority, .bash_profile, .config folder, .dbus folder.

Ever since then, it hasn't been autostarting my main.py on boot. Even now, after new .XAuthority, .bash_profile, etc have been created, it still isn't auto-starting my program.

Is there a way to fix this? Or another way to autostart main.py?

Note: I'm running Debian on my beaglebone and lxqt.

1

There are 1 best solutions below

1
On

sudo nano /etc/rc.local then add the executing command at the end of the file right before exit 0. something like

python /path/to/file/main.py &
exit 0

remember to add & at the end of the command so the the command would run as deamon and won't stop the os from booting if it has an infinite loop in it.