Is there a way to delay the automatic start in KDE autostart until wifi is up?

Hi,

I put Firefox in the KDE settings autostart list.
The problem with this is that Firefox starts before the wifi network is up, and that the tabs don’t load their contents until I manually click refresh in all open tabs and on the lastpass extension.
This is more click work than starting Firefox manually when the network comes up.

So is there a way to delay applications autostarting with a few seconds, of only autostart them as soon as the network is up ?

1 Like

Create a script, make it executable and use the corresponding file in the KDE autostart entry:

#!/bin/bash
sleep 15 && firefox

Please, use a search engine how to implement this, there are hundreds of examples.

2 Likes

KDE>setting>Startup and Shutdown>Desktop Sessions>On Login>Restore Previous Session

Don’t close Firefox when you shutdown
Network resolves itself before stuff starts opening

I never close firefox when I shutdown.
The problem is that wifi only comes up about 10s after Firefox started.
In that case I get the click to try again button in a number of tabs, and my lastpass extension does not work anymore until I close and re-open firefox when the network is up.

As there is no delay setting in KDE, I suppose the best solution up to now is the one from wollie, to make a script that waits for a number of seconds before starting firefox.

Hi @mbbs1024,

@Wollie’s way might work. It’s simple, at least.

Another way that might or might not work , I don’t know, I’ve never tried it, is to use a systemd script, that waits for the network to come online before running. See this for more information.

Hope it helps.

Edit:
Seems I was right, according to the first answer in this post on reddit:

Make a systemd unit (service) in /etc/systemd/system/unit-name.service like this:

[Unit]
Description=Service description
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
Restart=on-failure
ExecStart=/path/to/your/script

[Install]
WantedBy=multi-user.target

Good luck!

Putting FF on the autostart list, gives it priority over the network

The systemd way does not work, when I look in journalctl, I don’t see an entry either.
There is only one entry, when I started firefox manually.

So the solution from wollie still is the best.

As long as it works, right?

Just remember to replace it if you come across something better.

Indeed. thx anyway for your help, if I have the time, I’ll dive a little deeper into the systemd thing to see why it does not work, and in the mean time learn a bit about systemd.

You’re welcome! And that is the best way to do things in my opinion.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.