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 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/components/ClipboardButton.tsx') 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"}
-- cgit v1.2.3