summaryrefslogtreecommitdiff
path: root/src/components/ClipboardButton.tsx
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-18 12:00:31 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-18 12:00:31 -0400
commit48ee73dae1bdecec47ccbaf5456be8c5937cb0fd (patch)
tree487b0829755b51216df418477173dbb88e9af269 /src/components/ClipboardButton.tsx
parentda113f878447e0830d414bb90b79b9a03d8cedec (diff)
downloaddecky-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.tsx28
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>