From 48ee73dae1bdecec47ccbaf5456be8c5937cb0fd Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Fri, 18 Jul 2025 12:00:31 -0400 Subject: new profile method workaround for sudo global use --- src/components/ClipboardButton.tsx | 28 +++++++++++++++++++++++----- src/components/Content.tsx | 8 ++++---- src/components/LaunchOptionInfo.tsx | 25 +++++++++++++++++++++++++ src/components/UsageInstructions.tsx | 26 +++++++++++++++++++++++--- src/components/index.ts | 3 ++- 5 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 src/components/LaunchOptionInfo.tsx (limited to 'src/components') 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() {
- -
Launch Option Clipboard
+ {copied ? : } +
{copied ? "Copied!" : "Copy Launch Option"}
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() { /> )} - {/* */} + - {/* */} + {/* Plugin Update Checker */} 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 ( + + +
For each game where you want to use lsfg-vk:
+
+ 1. Right-click the game in Steam → Properties
+ 2. Add this to Launch Options: LSFG_PROCESS=decky-lsfg-vk %command%
+ 3. Or use the "Copy Launch Option" button above +
+
+ This temporary solution allows hot-reloading while keeping you on the latest lsfg-vk version. +
+ + } + /> +
+ ); +} 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,12 +33,32 @@ 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." } + +
+ Required Launch Option: +
+ LSFG_PROCESS=decky-lsfg-vk %command% +
+
+
- 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.
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"; -- cgit v1.2.3