diff --git a/src/lib/Session.cpp b/src/lib/Session.cpp index 49168b3..cd8c771 100644 --- a/src/lib/Session.cpp +++ b/src/lib/Session.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -330,13 +331,27 @@ void Session::run() // the background color is deemed dark or not QString backgroundColorHint = _hasDarkBackground ? "COLORFGBG=15;0" : "COLORFGBG=0;15"; + QStringList environmentVars = _environment << backgroundColorHint; + + // If we are running on Flatpak, we should have access to the host + if (!QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty()) { + QStringList flatpakArgs; + flatpakArgs << QLatin1String("--host"); + for (auto env : qAsConst(environmentVars)) + flatpakArgs << QStringLiteral("--env=%1").arg(env); + flatpakArgs << exec; + exec = QLatin1String("/usr/bin/flatpak-spawn"); + arguments = flatpakArgs; + environmentVars = QStringList(); + } + /* if we do all the checking if this shell exists then we use it ;) * Dont know about the arguments though.. maybe youll need some more checking im not sure * However this works on Arch and FreeBSD now. */ int result = _shellProcess->start(exec, arguments, - _environment << backgroundColorHint, + environmentVars, windowId(), _addToUtmp);