From 43475aaf04db2eb69cd2d993950c715f7ac30066 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 23 Jan 2025 15:25:29 -0500 Subject: detect app and set launch options working --- src/index.tsx | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'src/index.tsx') 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(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 (
{mainRunningApp ? ( - Main Running App: {mainRunningApp.display_name} + <> + Main Running App: {mainRunningApp.appid} + + Set Launch Options + + ) : ( No app is currently running. )}
+ {result && ( + +
{result}
+
+ )}
); } @@ -177,8 +203,9 @@ export default definePlugin(() => ({ titleView:
Framegen Plugin
, content: ( <> - + + ), icon: , @@ -190,7 +217,7 @@ export default definePlugin(() => ({ function MainContent() { return ( <> - + {/* Other content */} ); } \ No newline at end of file -- cgit v1.2.3