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/components/ClipboardButton.tsx | |
| 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/components/ClipboardButton.tsx')
| -rw-r--r-- | src/components/ClipboardButton.tsx | 28 |
1 files changed, 23 insertions, 5 deletions
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> |
