summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-01-23 15:25:29 -0500
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-01-23 15:25:29 -0500
commit43475aaf04db2eb69cd2d993950c715f7ac30066 (patch)
tree6c563c763dbac78a8860a695f4846ec47e144a36 /src
parente34d35ea80e46f3e4c87badf9a8aba2267d64a1d (diff)
downloadDecky-Framegen-43475aaf04db2eb69cd2d993950c715f7ac30066.tar.gz
Decky-Framegen-43475aaf04db2eb69cd2d993950c715f7ac30066.zip
detect app and set launch options working
Diffstat (limited to 'src')
-rwxr-xr-xsrc/index.tsx35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/index.tsx b/src/index.tsx
index 288e1e6..ce44983 100755
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -3,7 +3,7 @@ import {
PanelSection,
PanelSectionRow,
ButtonItem,
- Router,
+ Router
} from "@decky/ui";
import { definePlugin, callable } from "@decky/api";
import { FaShip } from "react-icons/fa";
@@ -156,18 +156,44 @@ function FGModInstallerSection() {
function MainRunningApp() {
const mainRunningApp = Router.MainRunningApp;
+ const [result, setResult] = useState<string | null>(null);
+
+ const handleSetLaunchOptions = async () => {
+ if (mainRunningApp) {
+ try {
+ const response = await SteamClient.Apps.SetAppLaunchOptions(mainRunningApp.appid, '/home/deck/fgmod/fgmod %COMMAND%');
+ setResult(`Launch options set successfully: ${response}`);
+ } catch (error) {
+ if (error instanceof Error) {
+ setResult(`Error setting launch options: ${error.message}`);
+ } else {
+ setResult('Error setting launch options');
+ }
+ }
+ }
+ };
return (
<PanelSection title="Main Running App">
<PanelSectionRow>
<div>
{mainRunningApp ? (
- <span>Main Running App: {mainRunningApp.display_name}</span>
+ <>
+ <span>Main Running App: {mainRunningApp.appid}</span>
+ <ButtonItem layout="below" onClick={handleSetLaunchOptions}>
+ Set Launch Options
+ </ButtonItem>
+ </>
) : (
<span>No app is currently running.</span>
)}
</div>
</PanelSectionRow>
+ {result && (
+ <PanelSectionRow>
+ <div>{result}</div>
+ </PanelSectionRow>
+ )}
</PanelSection>
);
}
@@ -177,8 +203,9 @@ export default definePlugin(() => ({
titleView: <div>Framegen Plugin</div>,
content: (
<>
- <MainContent />
+ <FGModInstallerSection />
<MainRunningApp />
+ <MainContent />
</>
),
icon: <FaShip />,
@@ -190,7 +217,7 @@ export default definePlugin(() => ({
function MainContent() {
return (
<>
- <FGModInstallerSection />
+ {/* Other content */}
</>
);
} \ No newline at end of file