try to blind fix autostarting for linux, now should also take all CLI args into account when generating desktop file
This commit is contained in:
parent
d91b2927ce
commit
6bde01321f
@ -4,7 +4,7 @@ Type=Application
|
||||
Terminal=false
|
||||
Name=RSS Guard
|
||||
TryExec=%1
|
||||
Exec=%1
|
||||
Exec=%2
|
||||
Hidden=false
|
||||
X-GNOME-Autostart-Delay=15
|
||||
X-LXQt-Need-Tray=true
|
@ -175,11 +175,27 @@ bool SystemFactory::setAutoStartStatus(AutoStartStatus new_status) {
|
||||
try {
|
||||
QString desktop_file_contents = QString::fromUtf8(IOFactory::readFile(source_autostart_desktop_file));
|
||||
|
||||
#if defined(IS_FLATPAK_BUILD)
|
||||
desktop_file_contents = desktop_file_contents.arg(QSL("flatpak run %1").arg(QSL(APP_REVERSE_NAME)));
|
||||
#else
|
||||
desktop_file_contents = desktop_file_contents.arg(QSL(APP_LOW_NAME));
|
||||
#endif
|
||||
QStringList args = qApp->rawCliArgs();
|
||||
auto std_args = boolinq::from(args)
|
||||
.select([](const QString& arg) {
|
||||
if (arg.contains(QL1S(" ")) && !arg.startsWith(QL1S("\""))) {
|
||||
return QSL("\"%1\"").arg(arg);
|
||||
}
|
||||
else {
|
||||
return arg;
|
||||
}
|
||||
})
|
||||
.toStdList();
|
||||
args = FROM_STD_LIST(QStringList, std_args);
|
||||
|
||||
QString app_run_line = args.join(QL1C(' '));
|
||||
desktop_file_contents = desktop_file_contents.arg(args.at(0), app_run_line);
|
||||
|
||||
// #if defined(IS_FLATPAK_BUILD)
|
||||
// desktop_file_contents = desktop_file_contents.arg(QSL("flatpak run %1").arg(QSL(APP_REVERSE_NAME)));
|
||||
// #else
|
||||
// desktop_file_contents = desktop_file_contents.arg(QSL(APP_LOW_NAME));
|
||||
// #endif
|
||||
|
||||
IOFactory::writeFile(destination_file, desktop_file_contents.toUtf8());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user