How do I launch applications that require a tray at startup in Sway?

I want to launch megasync and syncthingtray at startup in Sway. Both of these programs provide a tray icon when launched. I can manually launch them just fine, but I’m not sure how to have them launch at startup. I tried adding exec megasync and exec syncthing to .config/sway/config.d/autostart_applications, but I found that when I started up my computer, they would show errors saying that the tray was not available. Is there some way to launch them after waybar initializes or something?

Still having the problem?

Did you try to autostart the programs at the very end of the Sway configuration? If you are using the standard config files EOS provides, add the commands you mentioned at the end of .config/sway/config.

That works! Thanks a lot!

I was wrong. It seemed to have worked before because I logged out and logged back in rather than rebooting my computer. When I reboot my computer, it seems that I continue to get the errors.