I have a Python-based app I want to autostart after login, but it needs a working internet connection to authenticate and sync data.
I added it to my session autostart (XFCE), but sometimes it launches before the Wi-Fi connects, causing it to fail silently.
Is there a clean way to delay the app launch until the system is connected to the network?
Would nm-online or a custom script in ~/.config/autostart be the best route? Or is there a Manjaro-friendly way to manage this with systemd or NetworkManager hooks?
As a new or infrequent forum user, please take some time to familiarise yourself with Forum requirements, and the many ways to use the forum to your benefit:
Update Announcements
The Update Announcements contain important information and a Known Issues and Solutions section that should generally be checked before posting a request for support.
System Information
While information from *-fetch type apps might be fine for someone wishing to buy your computer, for Support purposes it’s better to ask your system directly;
Output of the inxi command with appropriate parameters will achieve this (naturally, formatted according to forum guidelines) and will generally be more useful for those wishing to help:
Be prepared to provide output from other commands whenever asked. It’s equally important to provide as much actionable information as possible in your first post, rather than simply indicating there is a problem.
There is many ways you can do this… nm-online is just one - I would create a function as part of the app - to check for internet connection - using the requests library.
Our mirror utility pacman-mirrors contains functionality like this - so the following snippet will only work on a Manjaro Linux system
from pacman_mirrors.functions import httpFn
print(httpFn.check_internet_connection())
But the code providing the response is fairly simple…