I develop a program in Qt with C++. I need to add autostart setting to my app - when checkbox is checked autostart is set. When checkbox is not set - no autostart ! I have some code (paste only crucial part). It does not work with flatpak - instead of creating .desktop file in ~/.config/autostart it creates file in .var/app/com.../config/autostart SO autostart does not work.
QString autostartPath =
QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).at(0) + QLatin1String("/autostart");
QDir autostartDir(autostartPath);
if (!autostartDir.exists()) {
autostartDir.mkpath(autostartPath);
}
QFile autostartFile(autostartPath + R"(/MyAppName.desktop)");
QTextStream stream(&autostartFile);
stream << "[Desktop Entry]\n"
"Type=Application\n" +
"Exec=flatpak run" + value +
"Name=MyAppName\n"
...... etc
How can I set autostart for flatpak? How to create file in needed directory?
I need to make autostart from my code. No command line. No Flatseal. Please....