1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-13 21:07:46 +00:00

Add instructions to allow the Steam Flatpak to launch Astra

Currently Flatpak doesn't have a good way for apps to launch other apps
(even legitimately) so we have to tell the user to punch a hole in the
Steam Flatpak's sandbox.

Oh well, at least now we guide them on how to do it.
This commit is contained in:
Joshua Goins 2025-05-07 16:54:11 -04:00
parent 1537a8918d
commit bf4f44e8fb
3 changed files with 32 additions and 8 deletions

View file

@ -26,7 +26,7 @@ public:
bool hasSteam() const;
Q_SIGNALS:
void installFinished();
void installFinished(bool flatpak);
void error(QString message);
void removalFinished();
void isInstalledChanged();

View file

@ -41,10 +41,19 @@ void CompatibilityToolInstaller::installCompatibilityTool()
QProcess::execute(QStringLiteral("chmod"), {QStringLiteral("+x"), astraToolDir.absoluteFilePath(QStringLiteral("wrapper.sh"))});
// we need a run script to escape the compatibility tool quirk where it runs everything in the current directory
const auto runScriptContents = QStringLiteral(
"$STEAM_COMPAT_CLIENT_INSTALL_PATH/compatibilitytools.d/astra/steamwrap & p1=$!\nflatpak run zone.xiv.astra --steam \"$@\" & p2=$!\nwait -n\n[ \"$?\" "
"-gt 1 ] || kill \"$p1\" \"$p2\"\nwait");
QString runScriptContents;
if (steamType == SteamType::Flatpak) {
runScriptContents = QStringLiteral(
"$STEAM_COMPAT_CLIENT_INSTALL_PATH/compatibilitytools.d/astra/steamwrap & p1=$!\nflatpak-spawn --host -- flatpak run zone.xiv.astra --steam \"$@\" "
"& p2=$!\nwait -n\n[ \"$?\" "
"-gt 1 ] || kill \"$p1\" \"$p2\"\nwait");
} else {
runScriptContents = QStringLiteral(
"$STEAM_COMPAT_CLIENT_INSTALL_PATH/compatibilitytools.d/astra/steamwrap & p1=$!\nflatpak run zone.xiv.astra --steam \"$@\" & p2=$!\nwait -n\n[ "
"\"$?\" "
"-gt 1 ] || kill \"$p1\" \"$p2\"\nwait");
}
QFile runScriptFile(astraToolDir.absoluteFilePath(QStringLiteral("run.sh")));
runScriptFile.open(QIODevice::WriteOnly | QIODevice::Text);
@ -91,7 +100,7 @@ void CompatibilityToolInstaller::installCompatibilityTool()
compatibilityToolFile.write(compatibilityToolContents.toUtf8());
compatibilityToolFile.close();
Q_EMIT installFinished();
Q_EMIT installFinished(steamType == SteamType::Flatpak);
Q_EMIT isInstalledChanged();
}

View file

@ -7,6 +7,7 @@ import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.kquickcontrolsaddons as KQuickControlsAddons
import zone.xiv.astra
@ -61,12 +62,26 @@ FormCard.FormCardPage {
parent: page.QQC2.Overlay.overlay
}
readonly property Kirigami.Action copyCommandAction: Kirigami.Action {
icon.name: "edit-copy-symbolic"
text: i18n("Copy Command")
onTriggered: clipboard.content = "flatpak override com.valvesoftware.Steam --talk-name=org.freedesktop.Flatpak"
}
readonly property KQuickControlsAddons.Clipboard clipboard: KQuickControlsAddons.Clipboard {}
data: Connections {
target: page.installer
function onInstallFinished(): void {
function onInstallFinished(flatpak: bool): void {
page.errorDialog.title = i18n("Successful Installation");
page.errorDialog.subtitle = i18n("You need to relaunch Steam for Astra to show up as a Compatibility Tool.");
if (flatpak) {
page.errorDialog.subtitle = i18n("You need to relaunch Steam for Astra to show up as a Compatibility Tool.\n\nSince you are using the Steam Flatpak, you must give it permissions to allow it to launch Astra:\nflatpak override com.valvesoftware.Steam --talk-name=org.freedesktop.Flatpak");
page.errorDialog.customFooterActions = [copyCommandAction];
} else {
page.errorDialog.subtitle = i18n("You need to relaunch Steam for Astra to show up as a Compatibility Tool.");
page.errorDialog.customFooterActions = [];
}
page.errorDialog.open();
}