diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-18 12:00:31 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-18 12:00:31 -0400 |
| commit | 48ee73dae1bdecec47ccbaf5456be8c5937cb0fd (patch) | |
| tree | 487b0829755b51216df418477173dbb88e9af269 /src | |
| parent | da113f878447e0830d414bb90b79b9a03d8cedec (diff) | |
| download | decky-lsfg-vk-48ee73dae1bdecec47ccbaf5456be8c5937cb0fd.tar.gz decky-lsfg-vk-48ee73dae1bdecec47ccbaf5456be8c5937cb0fd.zip | |
new profile method workaround for sudo global use
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/lsfgApi.ts | 7 | ||||
| -rw-r--r-- | src/components/ClipboardButton.tsx | 28 | ||||
| -rw-r--r-- | src/components/Content.tsx | 8 | ||||
| -rw-r--r-- | src/components/LaunchOptionInfo.tsx | 25 | ||||
| -rw-r--r-- | src/components/UsageInstructions.tsx | 26 | ||||
| -rw-r--r-- | src/components/index.ts | 3 |
6 files changed, 84 insertions, 13 deletions
diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts index 7d37f4e..5d866ef 100644 --- a/src/api/lsfgApi.ts +++ b/src/api/lsfgApi.ts @@ -66,6 +66,12 @@ export interface UpdateDownloadResult { error?: string; } +export interface LaunchOptionResult { + launch_option: string; + instructions: string; + explanation: string; +} + // API functions export const installLsfgVk = callable<[], InstallationResult>("install_lsfg_vk"); export const uninstallLsfgVk = callable<[], InstallationResult>("uninstall_lsfg_vk"); @@ -73,6 +79,7 @@ export const checkLsfgVkInstalled = callable<[], InstallationStatus>("check_lsfg export const checkLosslessScalingDll = callable<[], DllDetectionResult>("check_lossless_scaling_dll"); export const getLsfgConfig = callable<[], ConfigResult>("get_lsfg_config"); export const getConfigSchema = callable<[], ConfigSchemaResult>("get_config_schema"); +export const getLaunchOption = callable<[], LaunchOptionResult>("get_launch_option"); // Updated config function using centralized configuration export const updateLsfgConfig = callable< diff --git a/src/components/ClipboardButton.tsx b/src/components/ClipboardButton.tsx index 3760e81..cf11e6e 100644 --- a/src/components/ClipboardButton.tsx +++ b/src/components/ClipboardButton.tsx @@ -1,9 +1,26 @@ +import { useState } from "react"; import { PanelSectionRow, ButtonItem } from "@decky/ui"; -import { FaExternalLinkAlt } from "react-icons/fa"; +import { FaClipboard, FaCheck } from "react-icons/fa"; +import { getLaunchOption } from "../api/lsfgApi"; export function ClipboardButton() { - const handleClipboardClick = () => { - window.open("https://github.com/xXJSONDeruloXx/decky-lossless-scaling-vk/wiki/Clipboard", "_blank"); + const [copied, setCopied] = useState(false); + + const handleClipboardClick = async () => { + try { + // Get the launch option from the backend + const response = await getLaunchOption(); + const launchOption = response.launch_option; + + // Copy to clipboard + await navigator.clipboard.writeText(launchOption); + setCopied(true); + + // Reset the copied state after 2 seconds + setTimeout(() => setCopied(false), 2000); + } catch (error) { + console.error("Failed to copy launch option:", error); + } }; return ( @@ -11,10 +28,11 @@ export function ClipboardButton() { <ButtonItem layout="below" onClick={handleClipboardClick} + description="Copy the launch option needed for Steam games" > <div style={{ display: "flex", alignItems: "center", gap: "8px" }}> - <FaExternalLinkAlt /> - <div>Launch Option Clipboard</div> + {copied ? <FaCheck style={{ color: "green" }} /> : <FaClipboard />} + <div>{copied ? "Copied!" : "Copy Launch Option"}</div> </div> </ButtonItem> </PanelSectionRow> diff --git a/src/components/Content.tsx b/src/components/Content.tsx index b248313..613e722 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -5,9 +5,9 @@ import { useInstallationActions } from "../hooks/useInstallationActions"; import { StatusDisplay } from "./StatusDisplay"; import { InstallationButton } from "./InstallationButton"; import { ConfigurationSection } from "./ConfigurationSection"; -// import { UsageInstructions } from "./UsageInstructions"; +import { UsageInstructions } from "./UsageInstructions"; import { WikiButton } from "./WikiButton"; -// import { ClipboardButton } from "./ClipboardButton"; +import { ClipboardButton } from "./ClipboardButton"; import { PluginUpdateChecker } from "./PluginUpdateChecker"; import { ConfigurationData } from "../config/configSchema"; @@ -74,10 +74,10 @@ export function Content() { /> )} - {/* <UsageInstructions config={config} /> */} + <UsageInstructions config={config} /> <WikiButton /> - {/* <ClipboardButton /> */} + <ClipboardButton /> {/* Plugin Update Checker */} <PluginUpdateChecker /> diff --git a/src/components/LaunchOptionInfo.tsx b/src/components/LaunchOptionInfo.tsx new file mode 100644 index 0000000..298c45a --- /dev/null +++ b/src/components/LaunchOptionInfo.tsx @@ -0,0 +1,25 @@ +import { PanelSectionRow, Field } from "@decky/ui"; + +export function LaunchOptionInfo() { + return ( + <PanelSectionRow> + <Field + bottomSeparator="none" + label="Setup Instructions" + description={ + <> + <div>For each game where you want to use lsfg-vk:</div> + <div style={{ marginTop: "8px" }}> + 1. Right-click the game in Steam → Properties<br/> + 2. Add this to Launch Options: <code>LSFG_PROCESS=decky-lsfg-vk %command%</code><br/> + 3. Or use the "Copy Launch Option" button above + </div> + <div style={{ marginTop: "8px", fontStyle: "italic" }}> + This temporary solution allows hot-reloading while keeping you on the latest lsfg-vk version. + </div> + </> + } + /> + </PanelSectionRow> + ); +} diff --git a/src/components/UsageInstructions.tsx b/src/components/UsageInstructions.tsx index d156f9d..32aa0ff 100644 --- a/src/components/UsageInstructions.tsx +++ b/src/components/UsageInstructions.tsx @@ -33,8 +33,8 @@ export function UsageInstructions({ config }: UsageInstructionsProps) { }} > {config.enable - ? "LSFG is enabled globally. The layer will be active for all games automatically. No launch arguments needed." - : "LSFG is disabled. Enable it above to activate frame generation for all games." + ? "LSFG is enabled. Add the launch option below to Steam games to activate frame generation." + : "LSFG is disabled. Enable it above and add the launch option to activate frame generation." } </div> </PanelSectionRow> @@ -45,6 +45,26 @@ export function UsageInstructions({ config }: UsageInstructionsProps) { fontSize: "12px", lineHeight: "1.4", opacity: "0.8", + backgroundColor: "rgba(255, 255, 255, 0.1)", + padding: "8px", + borderRadius: "4px", + fontFamily: "monospace", + marginTop: "8px", + marginBottom: "8px" + }} + > + Required Launch Option: + <br /> + <strong>LSFG_PROCESS=decky-lsfg-vk %command%</strong> + </div> + </PanelSectionRow> + + <PanelSectionRow> + <div + style={{ + fontSize: "12px", + lineHeight: "1.4", + opacity: "0.8", whiteSpace: "pre-wrap" }} > @@ -69,7 +89,7 @@ export function UsageInstructions({ config }: UsageInstructionsProps) { marginTop: "8px" }} > - The configuration is stored in ~/.config/lsfg-vk/conf.toml and applies to all games globally. + Add the launch option to each game's Properties → Launch Options in Steam. The configuration is stored in ~/.config/lsfg-vk/conf.toml and hot-reloads while games are running. </div> </PanelSectionRow> </> diff --git a/src/components/index.ts b/src/components/index.ts index ec4c194..ed0b803 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -4,5 +4,6 @@ export { InstallationButton } from "./InstallationButton"; export { ConfigurationSection } from "./ConfigurationSection"; // export { UsageInstructions } from "./UsageInstructions"; export { WikiButton } from "./WikiButton"; -// export { ClipboardButton } from "./ClipboardButton"; +export { ClipboardButton } from "./ClipboardButton"; +export { LaunchOptionInfo } from "./LaunchOptionInfo"; export { PluginUpdateChecker } from "./PluginUpdateChecker"; |
