From f3846f88402b6216675c9c48c04ab5a30cce3062 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Fri, 18 Jul 2025 12:12:55 -0400 Subject: restore clipboard wiki button --- py_modules/lsfg_vk/base_service.py | 1 + py_modules/lsfg_vk/installation.py | 23 ++++++++++++++++++++--- py_modules/lsfg_vk/plugin.py | 4 ++-- src/components/ClipboardButton.tsx | 28 +++++----------------------- src/components/ConfigurationSection.tsx | 2 +- src/components/UsageInstructions.tsx | 4 ++-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/py_modules/lsfg_vk/base_service.py b/py_modules/lsfg_vk/base_service.py index a796480..b595b07 100644 --- a/py_modules/lsfg_vk/base_service.py +++ b/py_modules/lsfg_vk/base_service.py @@ -30,6 +30,7 @@ class BaseService: self.local_lib_dir = self.user_home / LOCAL_LIB self.local_share_dir = self.user_home / VULKAN_LAYER_DIR self.lsfg_script_path = self.user_home / SCRIPT_NAME + self.lsfg_launch_script_path = self.user_home / SCRIPT_NAME # ~/lsfg launch script self.config_dir = self.user_home / CONFIG_DIR self.config_file_path = self.config_dir / CONFIG_FILENAME diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py index fc9ac97..d193219 100644 --- a/py_modules/lsfg_vk/installation.py +++ b/py_modules/lsfg_vk/installation.py @@ -54,6 +54,9 @@ class InstallationService(BaseService): # Create the config file self._create_config_file() + # Create the lsfg launch script + self._create_lsfg_launch_script() + self.log.info("lsfg-vk installed successfully") return {"success": True, "message": "lsfg-vk installed successfully", "error": None} @@ -122,6 +125,19 @@ class InstallationService(BaseService): if config["dll"]: self.log.info(f"Configured DLL path: {config['dll']}") + def _create_lsfg_launch_script(self) -> None: + """Create the ~/lsfg launch script for easier game setup""" + script_content = """#!/bin/bash +# lsfg-vk launch script generated by decky-lossless-scaling-vk plugin +# This script sets up the environment for lsfg-vk to work with the plugin configuration +export LSFG_PROCESS=decky-lsfg-vk +exec "$@" +""" + + # Write the script file + self._write_file(self.lsfg_launch_script_path, script_content, 0o755) + self.log.info(f"Created lsfg launch script at {self.lsfg_launch_script_path}") + def check_installation(self) -> InstallationCheckResponse: """Check if lsfg-vk is already installed @@ -168,13 +184,13 @@ class InstallationService(BaseService): """ try: removed_files = [] - files_to_remove = [self.lib_file, self.json_file, self.config_file_path] + files_to_remove = [self.lib_file, self.json_file, self.config_file_path, self.lsfg_launch_script_path] for file_path in files_to_remove: if self._remove_if_exists(file_path): removed_files.append(str(file_path)) - # Also try to remove the old script file if it exists + # Also try to remove the old script file if it exists (for backward compatibility) if self._remove_if_exists(self.lsfg_script_path): removed_files.append(str(self.lsfg_script_path)) @@ -219,10 +235,11 @@ class InstallationService(BaseService): self.log.info(f" Library file: {self.lib_file}") self.log.info(f" JSON file: {self.json_file}") self.log.info(f" Config file: {self.config_file_path}") + self.log.info(f" Launch script: {self.lsfg_launch_script_path}") self.log.info(f" Old script file: {self.lsfg_script_path}") removed_files = [] - files_to_remove = [self.lib_file, self.json_file, self.config_file_path, self.lsfg_script_path] + files_to_remove = [self.lib_file, self.json_file, self.config_file_path, self.lsfg_launch_script_path, self.lsfg_script_path] for file_path in files_to_remove: try: diff --git a/py_modules/lsfg_vk/plugin.py b/py_modules/lsfg_vk/plugin.py index 9caf2ea..101542c 100644 --- a/py_modules/lsfg_vk/plugin.py +++ b/py_modules/lsfg_vk/plugin.py @@ -360,9 +360,9 @@ class Plugin: Dict containing the launch option string and instructions """ return { - "launch_option": "LSFG_PROCESS=decky-lsfg-vk %command%", + "launch_option": "~/lsfg %command%", "instructions": "Add this to your game's launch options in Steam Properties", - "explanation": "This tells lsfg-vk to use the plugin-managed configuration for this game" + "explanation": "The lsfg script is created during installation and sets up the environment for the plugin" } # Lifecycle methods diff --git a/src/components/ClipboardButton.tsx b/src/components/ClipboardButton.tsx index cf11e6e..3760e81 100644 --- a/src/components/ClipboardButton.tsx +++ b/src/components/ClipboardButton.tsx @@ -1,26 +1,9 @@ -import { useState } from "react"; import { PanelSectionRow, ButtonItem } from "@decky/ui"; -import { FaClipboard, FaCheck } from "react-icons/fa"; -import { getLaunchOption } from "../api/lsfgApi"; +import { FaExternalLinkAlt } from "react-icons/fa"; export function ClipboardButton() { - 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); - } + const handleClipboardClick = () => { + window.open("https://github.com/xXJSONDeruloXx/decky-lossless-scaling-vk/wiki/Clipboard", "_blank"); }; return ( @@ -28,11 +11,10 @@ export function ClipboardButton() {
- {copied ? : } -
{copied ? "Copied!" : "Copy Launch Option"}
+ +
Launch Option Clipboard
diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index f44dd4f..bfbeb98 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -48,7 +48,7 @@ export function ConfigurationSection({ Required Launch Option:
- LSFG_PROCESS=decky-lsfg-vk %command% + ~/lsfg %command%
@@ -89,7 +89,7 @@ export function UsageInstructions({ config }: UsageInstructionsProps) { marginTop: "8px" }} > - 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. + Add the launch option to each game's Properties → Launch Options in Steam. The lsfg script is automatically created during installation and connects your games to the plugin's configuration. The configuration is stored in ~/.config/lsfg-vk/conf.toml and hot-reloads while games are running. -- cgit v1.2.3