Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6f5dc01876 |
|||
|
|
f912f491e2 |
||
|
|
13d5c3c75e | ||
|
|
105cbaffb6 |
||
|
|
bf767ad808 | ||
|
|
ba5cc801c5 | ||
|
|
82b4160655 |
11 changed files with 1103 additions and 761 deletions
|
|
@ -1,3 +1,6 @@
|
|||
> [!TIP]
|
||||
> This is a fork of [Quick Launch by Fisch03](https://github.com/Fisch03/SDH-QuickLaunch) that has been modified to work on [Anatase](https://anatase.org/). Since Anatase runs Steam in a Flatpak, launching other Flatpaks and apps doesn't normally work. The purpose of this fork is to replace calls to /usr/bin/flatpak to /app/bin/flatpak, which is a wrapper that allows launching other Flatpaks within Anatase's Steam package.
|
||||
|
||||
# SDH-QuickLaunch
|
||||
[Decky Loader](https://github.com/SteamDeckHomebrew/PluginLoader) Plugin to quickly launch Apps from the Quick Access Menu without adding them as shortcuts, and add new shortcuts entirely
|
||||
|
||||
|
|
|
|||
67
main.py
67
main.py
|
|
@ -10,6 +10,8 @@ from subprocess import Popen, PIPE
|
|||
from urllib.error import HTTPError
|
||||
from urllib.request import urlopen, Request
|
||||
|
||||
FLATPAK_RUNNER = "flatpak" # or explicitly: /app/bin/flatpak
|
||||
HOST_RUNNER = "hrun" # or explicitly: /app/bin/hrun
|
||||
|
||||
confdir = os.environ["DECKY_PLUGIN_SETTINGS_DIR"]
|
||||
|
||||
|
|
@ -24,22 +26,58 @@ def split_string(string):
|
|||
|
||||
class Plugin:
|
||||
async def get_flatpaks(self):
|
||||
proc = Popen(
|
||||
'flatpak list --app --columns="name,application" | awk \'BEGIN {FS="\\t"} {print "{\\"name\\":\\""$1"\\",\\"exec\\":\\"/usr/bin/flatpak run "$2"\\"},"}\\\'',
|
||||
stdout=PIPE,
|
||||
stderr=None,
|
||||
shell=True,
|
||||
)
|
||||
packages = proc.communicate()[0]
|
||||
packages = packages.decode("utf-8")
|
||||
packages = packages[:-2]
|
||||
return "[" + packages + "]"
|
||||
def list_flatpaks(cmd):
|
||||
flatpaks = []
|
||||
|
||||
clean_env = os.environ.copy()
|
||||
clean_env["LD_LIBRARY_PATH"] = ""
|
||||
with Popen(cmd, stdout=PIPE, stderr=None, env=clean_env, text=True) as p:
|
||||
for line in p.stdout:
|
||||
if '\t' not in line:
|
||||
continue
|
||||
|
||||
name, app_id = line.strip().split('\t', 1)
|
||||
|
||||
name = name.strip()
|
||||
app_id = app_id.strip()
|
||||
if not name or not app_id:
|
||||
continue
|
||||
|
||||
flatpaks.append({
|
||||
"id": app_id,
|
||||
"name": name,
|
||||
"exec": f"{FLATPAK_RUNNER} run {app_id}"
|
||||
})
|
||||
|
||||
return flatpaks
|
||||
|
||||
global_flatpaks = list_flatpaks([
|
||||
'flatpak', 'list', '--app', '--columns=name,application'
|
||||
])
|
||||
|
||||
local_flatpaks = list_flatpaks([
|
||||
'runuser', '-l', decky_plugin.DECKY_USER, '-c',
|
||||
'flatpak list --app --columns=name,application'
|
||||
])
|
||||
|
||||
seen = set()
|
||||
unique_flatpaks = []
|
||||
|
||||
for flatpak in global_flatpaks + local_flatpaks:
|
||||
if flatpak["id"] not in seen:
|
||||
seen.add(flatpak["id"])
|
||||
unique_flatpaks.append(flatpak)
|
||||
|
||||
sorted_items = sorted(unique_flatpaks, key=lambda x: x.get("name", "").lower())
|
||||
|
||||
return jsonDumps(sorted_items)
|
||||
|
||||
async def get_desktops(self):
|
||||
packages = []
|
||||
for desktopFile in chain(
|
||||
Path("/usr/share/applications").glob("*.desktop"),
|
||||
Path(f"{decky_plugin.DECKY_USER_HOME}/.local/share/applications/").glob("*.desktop"),
|
||||
Path("/var/usrlocal/share/applications").glob("*.desktop"),
|
||||
):
|
||||
if not desktopFile.is_file():
|
||||
continue
|
||||
|
|
@ -53,13 +91,20 @@ class Plugin:
|
|||
package["name"] = line[5:]
|
||||
elif line.startswith("Exec="):
|
||||
foundExec = True
|
||||
package["exec"] = line[5:]
|
||||
execTarget = line[5:].split(" ", 1)
|
||||
decky_plugin.logger.info("- Exec path: " + str(execTarget))
|
||||
runner = FLATPAK_RUNNER if execTarget[0].endswith("flatpak") else HOST_RUNNER
|
||||
package["exec"] = f"{runner} {execTarget[1]}"
|
||||
if foundName and foundExec:
|
||||
decky_plugin.logger.info("+ Desktop app: " + package["name"])
|
||||
packages.append(package)
|
||||
break
|
||||
|
||||
return jsonDumps(packages)
|
||||
|
||||
async def get_DECKY_USER_HOME(self):
|
||||
return decky_plugin.DECKY_USER_HOME
|
||||
|
||||
async def get_config(self):
|
||||
with open(os.path.join(confdir, "config.json"), "r") as f:
|
||||
return json.load(f)
|
||||
|
|
|
|||
19
package.json
19
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "sdh-quicklaunch",
|
||||
"version": "1.1.1",
|
||||
"description": "Quickly Launch Apps from the Steam Deck Quick Access Menu without adding them as Shortcuts",
|
||||
"name": "sdh-quicklaunch-anatase",
|
||||
"version": "1.2.1",
|
||||
"description": "Quickly launch apps from the Steam Deck Quick Access Menu without adding them as shortcuts",
|
||||
"scripts": {
|
||||
"build": "shx rm -rf dist && rollup -c",
|
||||
"watch": "rollup -c -w",
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Fisch03/SDH-QuickLaunch.git"
|
||||
"url": "git+https://gitdab.com/dj/SDH-QuickLaunch-Anatase.git"
|
||||
},
|
||||
"keywords": [
|
||||
"decky",
|
||||
|
|
@ -17,12 +17,12 @@
|
|||
"steam-deck",
|
||||
"deck"
|
||||
],
|
||||
"author": "Fisch03",
|
||||
"author": "Fisch03 & djsime1",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Fisch03/SDH-QuickLaunch/issues"
|
||||
"url": "https://gitdab.com/dj/SDH-QuickLaunch-Anatase/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Fisch03/SDH-QuickLaunch#readme",
|
||||
"homepage": "https://gitdab.com/dj/SDH-QuickLaunch-Anatase",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^21.1.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
"@rollup/plugin-typescript": "^8.3.3",
|
||||
"@types/react": "16.14.0",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"decky-frontend-lib": "^3.24.5",
|
||||
"rollup": "^2.77.1",
|
||||
"rollup-plugin-import-assets": "^1.1.1",
|
||||
"shx": "^0.3.4",
|
||||
|
|
@ -38,14 +39,14 @@
|
|||
"typescript": "^4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"decky-frontend-lib": "^3.21.8",
|
||||
"react-icons": "^4.8.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"peerDependencyRules": {
|
||||
"ignoreMissing": [
|
||||
"react",
|
||||
"react-dom"
|
||||
"react-dom",
|
||||
"decky-frontend-lib"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
"name": "Quick Launch",
|
||||
"author": "Fisch03",
|
||||
"author": "Fisch03 & djsime1",
|
||||
"flags": ["root"],
|
||||
"publish": {
|
||||
"discord_id": "431374517462499328",
|
||||
"description": "Quickly Launch Non-Steam-Apps from the Quick Access menu without adding them as Shortcuts, or add them to the Steam Library.",
|
||||
"tags": [ "utility" ],
|
||||
"image": "https://raw.githubusercontent.com/Fisch03/SDH-QuickLaunch/master/ui_full.png"
|
||||
"image": "https://gitdab.com/dj/SDH-QuickLaunch-Anatase/raw/branch/master/ui_full.png"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1546
pnpm-lock.yaml
generated
1546
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -24,12 +24,13 @@ export default defineConfig({
|
|||
})
|
||||
],
|
||||
context: 'window',
|
||||
external: ['react', 'react-dom'],
|
||||
external: ['react', 'react-dom', 'decky-frontend-lib'],
|
||||
output: {
|
||||
file: 'dist/index.js',
|
||||
globals: {
|
||||
react: 'SP_REACT',
|
||||
'react-dom': 'SP_REACTDOM',
|
||||
'decky-frontend-lib': 'DFL',
|
||||
},
|
||||
format: 'iife',
|
||||
exports: 'default',
|
||||
|
|
|
|||
47
src/appoperations.tsx
Normal file
47
src/appoperations.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { ServerAPI } from "decky-frontend-lib";
|
||||
import { App, getLaunchOptions, getTarget } from "./apptypes";
|
||||
import { getImagesForGame } from "./steamgriddb";
|
||||
import { gameIDFromAppID, getShortcutID, createShortcut } from "./utils";
|
||||
import { Settings } from "./settings";
|
||||
|
||||
export async function launchApp(sAPI: ServerAPI, app: App) {
|
||||
let id: number = await getShortcutID(sAPI);
|
||||
|
||||
SteamClient.Apps.SetShortcutName(id, `[QL] ${app.name}`)
|
||||
SteamClient.Apps.SetShortcutLaunchOptions(id, getLaunchOptions(app))
|
||||
SteamClient.Apps.SetShortcutExe(id, `"${getTarget(app)}"`)
|
||||
SteamClient.Apps.SetShortcutStartDir(id, "/app/bin")
|
||||
SteamClient.Apps.SpecifyCompatTool(id, app.compatTool === undefined ? "" : app.compatTool)
|
||||
|
||||
setTimeout(() => {
|
||||
let gid = gameIDFromAppID(id);
|
||||
SteamClient.Apps.RunGame(gid,"",-1,100);
|
||||
}, 500)
|
||||
}
|
||||
|
||||
export function createAppShortcut(sAPI: ServerAPI, app: App, settings: Settings, launchOptions?: string, target?: string) {
|
||||
let shortcutLaunchOptions = launchOptions === undefined ? getLaunchOptions(app) : launchOptions
|
||||
let shortcutTarget = target === undefined ? getTarget(app) : target
|
||||
|
||||
createShortcut(app.name, shortcutLaunchOptions, shortcutTarget).then((id:number) => {
|
||||
if(settings.get("useGridDB")) {
|
||||
getImagesForGame(sAPI, settings.get("gridDBKey") ,app.name)
|
||||
.then(images => {
|
||||
if(images.Grid !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.Grid, "png", 0);
|
||||
if(images.Hero !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.Hero, "png", 1);
|
||||
if(images.Logo !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.Logo, "png", 2);
|
||||
//if(images.Grid !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.GridH, "png", 3);
|
||||
})
|
||||
.catch(() => {}); //Maybe display error to the user in the future?
|
||||
}
|
||||
|
||||
//This should theoretically not be needed with the new SteamClient.Apps.AddShortcut params but they seem to be pretty broken rn. It's not like it hurts either.
|
||||
setTimeout(() => {
|
||||
SteamClient.Apps.SetShortcutName(id, app.name);
|
||||
SteamClient.Apps.SetShortcutLaunchOptions(id, shortcutLaunchOptions);
|
||||
SteamClient.Apps.SetShortcutExe(id, `"${shortcutTarget}"`);
|
||||
SteamClient.Apps.SetShortcutStartDir(id, "/app/bin")
|
||||
SteamClient.Apps.SpecifyCompatTool(id, app.compatTool === undefined ? "" : app.compatTool);
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
export interface App {
|
||||
name: string;
|
||||
exec: string;
|
||||
compatTool?: string;
|
||||
}
|
||||
|
||||
export function getLaunchOptions(app: App) {
|
||||
|
|
|
|||
101
src/fileoptions.tsx
Normal file
101
src/fileoptions.tsx
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import {
|
||||
ServerAPI,
|
||||
ConfirmModal,
|
||||
ToastData,
|
||||
TextField,
|
||||
FilePickerRes,
|
||||
ToggleField
|
||||
} from "decky-frontend-lib"
|
||||
import { useEffect, useState } from "react"
|
||||
import { App } from "./apptypes"
|
||||
|
||||
import { createAppShortcut, launchApp } from "./appoperations"
|
||||
import { Settings } from "./settings"
|
||||
|
||||
export const FileOptionsModal = (props: {closeModal?: CallableFunction, settings: Settings, starApp: CallableFunction, filepath: FilePickerRes, serverAPI: ServerAPI}) => {
|
||||
const closeModal = () => { if (props.closeModal) {props.closeModal()} }
|
||||
const {settings, starApp, filepath, serverAPI} = props
|
||||
const [appName, setAppName] = useState<string>(filepath.path)
|
||||
const [compatTool, setCompatTool] = useState<string|undefined>()
|
||||
const [addToFavorites, setAddToFavorites] = useState<boolean>(false)
|
||||
const [addAsShortcut, setAddAsShortcut] = useState<boolean>(false)
|
||||
|
||||
useEffect(()=>{
|
||||
let filenameWithExtension = filepath.realpath.split(/[\\\/]/).pop() // potentially has an extension
|
||||
let filename = filenameWithExtension
|
||||
let fileext = ''
|
||||
if (filenameWithExtension) {
|
||||
filename = filenameWithExtension.slice(0, filenameWithExtension.lastIndexOf('.'))
|
||||
fileext = filenameWithExtension.slice(filenameWithExtension.lastIndexOf('.')+1, filenameWithExtension.length).toLowerCase()
|
||||
}
|
||||
let path = filepath.realpath.substring(0, filepath.realpath.length - (filenameWithExtension ? filenameWithExtension.length : 0))
|
||||
localStorage.setItem('decky-addtosteam', path)
|
||||
let appName = filename || filenameWithExtension || 'MissingAppName'
|
||||
setAppName(appName)
|
||||
if (['exe', 'bat'].includes(fileext)) setCompatTool('proton-experimental')
|
||||
},[])
|
||||
|
||||
const onOK = () => {
|
||||
let app: App = {
|
||||
name: appName,
|
||||
exec: filepath.realpath,
|
||||
compatTool: compatTool
|
||||
}
|
||||
|
||||
if (addAsShortcut) {
|
||||
createAppShortcut(serverAPI, app, settings, "", app.exec)
|
||||
|
||||
let toastData: ToastData = {
|
||||
title: 'Added Shortcut',
|
||||
body: appName,
|
||||
playSound: true,
|
||||
showToast: true
|
||||
}
|
||||
serverAPI.toaster.toast(toastData)
|
||||
} else if (addToFavorites) {
|
||||
//TODO: Doing this looses information about the compat tool. An app should also be able to store data about compat tools.
|
||||
starApp(app);
|
||||
} else {
|
||||
launchApp(serverAPI, app);
|
||||
}
|
||||
}
|
||||
|
||||
const nameField = <TextField
|
||||
label='Name'
|
||||
focusOnMount={true}
|
||||
value={appName}
|
||||
onChange={(e) => setAppName(e.currentTarget.value)}
|
||||
/>
|
||||
|
||||
return (
|
||||
<ConfirmModal
|
||||
strTitle='File Options'
|
||||
strOKButtonText={addAsShortcut ? 'Add Shortcut' : addToFavorites ? 'Add to starred Apps' : 'Launch'}
|
||||
closeModal={closeModal}
|
||||
onOK={onOK}
|
||||
onCancel={closeModal}
|
||||
onEscKeypress={closeModal}
|
||||
>
|
||||
<ToggleField
|
||||
label='Add to favorites'
|
||||
checked={addToFavorites}
|
||||
onChange={addToFavorites => {
|
||||
setAddToFavorites(addToFavorites);
|
||||
if(addToFavorites) setAddAsShortcut(false);
|
||||
}}
|
||||
/>
|
||||
|
||||
<ToggleField
|
||||
label='Add as shortcut'
|
||||
checked={addAsShortcut}
|
||||
onChange={addAsShortcut => {
|
||||
setAddAsShortcut(addAsShortcut);
|
||||
if(addAsShortcut) setAddToFavorites(false);
|
||||
}}
|
||||
/>
|
||||
|
||||
{ (addToFavorites || addAsShortcut) && nameField }
|
||||
|
||||
</ConfirmModal>
|
||||
)
|
||||
}
|
||||
|
|
@ -12,16 +12,23 @@ import {
|
|||
SingleDropdownOption,
|
||||
DropdownOption,
|
||||
DialogButton,
|
||||
Focusable
|
||||
Focusable,
|
||||
FileSelectionType
|
||||
} from "decky-frontend-lib";
|
||||
import { Fragment, useEffect } from "react";
|
||||
import { VFC, useState } from "react";
|
||||
import { FaRocket, FaStar, FaRegStar } from "react-icons/fa";
|
||||
|
||||
import { App, getLaunchOptions, getTarget } from "./apptypes";
|
||||
import { App } from "./apptypes";
|
||||
import { Settings } from "./settings";
|
||||
import { GridDBPanel, getImagesForGame } from "./steamgriddb";
|
||||
import { fetchApps, launchApp, createShortcut } from "./utils";
|
||||
import { GridDBPanel } from "./steamgriddb";
|
||||
import { fetchApps } from "./utils";
|
||||
import { FileOptionsModal } from "./fileoptions";
|
||||
import { launchApp, createAppShortcut } from "./appoperations";
|
||||
|
||||
enum SpecialSelections {
|
||||
FileShortcut = -1,
|
||||
}
|
||||
|
||||
let appList: App[] = [];
|
||||
|
||||
|
|
@ -81,6 +88,7 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({ serverAPI }) => {
|
|||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if(settings.get("enableAll")) newDropdownOptions.push({label: "Choose a file...", data: SpecialSelections.FileShortcut} as SingleDropdownOption);
|
||||
setDropdownOptions(newDropdownOptions);
|
||||
resolve();
|
||||
})
|
||||
|
|
@ -97,29 +105,46 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({ serverAPI }) => {
|
|||
|
||||
}
|
||||
|
||||
function newShortcut() {
|
||||
if(selectedApp === null) return;
|
||||
async function createFileShortcut() {
|
||||
let lastUsedPath = localStorage.getItem('decky-addtosteam')
|
||||
let deckyUserHome = (await serverAPI.callPluginMethod('get_DECKY_USER_HOME', {})).result
|
||||
let path: string
|
||||
if (lastUsedPath != null) {
|
||||
path = lastUsedPath
|
||||
} else if (typeof deckyUserHome === 'string') {
|
||||
path = deckyUserHome
|
||||
} else {
|
||||
return
|
||||
}
|
||||
let filepath = await serverAPI.openFilePickerV2(
|
||||
FileSelectionType.FILE,
|
||||
path,
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
true
|
||||
)
|
||||
if (!filepath) { return }
|
||||
|
||||
let app = appList[selectedApp];
|
||||
createShortcut(app.name, getLaunchOptions(app), getTarget(app)).then((id:number) => {
|
||||
if(settings.get("useGridDB")) {
|
||||
getImagesForGame(serverAPI, settings.get("gridDBKey"),app.name)
|
||||
.then(images => {
|
||||
if(images.Grid !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.Grid, "png", 0);
|
||||
if(images.Hero !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.Hero, "png", 1);
|
||||
if(images.Logo !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.Logo, "png", 2);
|
||||
//if(images.Grid !== null) SteamClient.Apps.SetCustomArtworkForApp(id, images.GridH, "png", 3);
|
||||
})
|
||||
.catch(() => {}); //Maybe display error to the user in the future?
|
||||
const starApp = async (app: App) => {
|
||||
let starredApps = settings.get("starredApps");
|
||||
if(!starredApps.find((a: App) => a.name === app.name && a.exec === app.exec))
|
||||
starredApps.push(app);
|
||||
settings.set("starredApps", starredApps);
|
||||
|
||||
await buildAppList();
|
||||
setSelectedApp(appList.findIndex((a: App) => a.name === app.name && a.exec === app.exec));
|
||||
}
|
||||
|
||||
//This should teoretically not be needed with the new SteamClient.Apps.AddShortcut params but they seem to be pretty broken rn. It's not like it hurts either.
|
||||
setTimeout(() => {
|
||||
SteamClient.Apps.SetShortcutName(id, app.name);
|
||||
SteamClient.Apps.SetShortcutLaunchOptions(id, getLaunchOptions(app));
|
||||
SteamClient.Apps.SetShortcutExe(id, `"${getTarget(app)}"`);
|
||||
}, 500)
|
||||
})
|
||||
showModal(<FileOptionsModal filepath={filepath} starApp={starApp} settings={settings} serverAPI={serverAPI}/>)
|
||||
}
|
||||
|
||||
function newShortcut() {
|
||||
if(selectedApp != null){
|
||||
createAppShortcut(serverAPI, appList[selectedApp], settings)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -134,7 +159,11 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({ serverAPI }) => {
|
|||
selectedOption={selectedApp}
|
||||
onChange={(e: SingleDropdownOption) => {
|
||||
setIsStarred(e.data < settings.get("starredApps").length);
|
||||
setSelectedApp(e.data);
|
||||
if(e.data === SpecialSelections.FileShortcut) {
|
||||
createFileShortcut();
|
||||
setSelectedApp(null);
|
||||
}
|
||||
else setSelectedApp(e.data);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { ServerAPI } from "decky-frontend-lib";
|
||||
|
||||
import { App, getLaunchOptions, getTarget } from "./apptypes";
|
||||
import { App } from "./apptypes";
|
||||
|
||||
export const createShortcut = (name: string, launchOptions: string = "", target:string = "") => {
|
||||
return SteamClient.Apps.AddShortcut(name,"/usr/bin/ifyouseethisyoufoundabug", target, launchOptions); //The Part after the last Slash does not matter because it should always be replaced when launching an app
|
||||
|
|
@ -35,19 +35,6 @@ export async function fetchApps(sAPI: ServerAPI, type: string): Promise<App[]> {
|
|||
return apps
|
||||
}
|
||||
|
||||
export const launchApp = async (sAPI: ServerAPI, app: App) => {
|
||||
let id: number = await getShortcutID(sAPI);
|
||||
|
||||
SteamClient.Apps.SetShortcutName(id, `[QL] ${app.name}`)
|
||||
SteamClient.Apps.SetShortcutLaunchOptions(id, getLaunchOptions(app))
|
||||
SteamClient.Apps.SetShortcutExe(id, `"${getTarget(app)}"`)
|
||||
|
||||
setTimeout(() => {
|
||||
let gid = gameIDFromAppID(id);
|
||||
SteamClient.Apps.RunGame(gid,"",-1,100);
|
||||
}, 500)
|
||||
}
|
||||
|
||||
export const getShortcutID = async (sAPI: ServerAPI) => {
|
||||
const result = await sAPI.callPluginMethod<any, number>("get_id", {})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue