Compare commits

..

No commits in common. "master" and "v1.2.0" have entirely different histories.

6 changed files with 716 additions and 881 deletions

View file

@ -1,6 +1,3 @@
> [!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 # 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 [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
@ -11,4 +8,4 @@
- To obtain a SteamGridDB API Key, login/register at [SteamGridDB](https://www.steamgriddb.com/). You can then generate an API Key [here](https://www.steamgriddb.com/profile/preferences/api) - To obtain a SteamGridDB API Key, login/register at [SteamGridDB](https://www.steamgriddb.com/). You can then generate an API Key [here](https://www.steamgriddb.com/profile/preferences/api)
## Caveats ## Caveats
You can only have one application open at at time You can only have one application open at at time

59
main.py
View file

@ -10,8 +10,6 @@ from subprocess import Popen, PIPE
from urllib.error import HTTPError from urllib.error import HTTPError
from urllib.request import urlopen, Request 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"] confdir = os.environ["DECKY_PLUGIN_SETTINGS_DIR"]
@ -26,58 +24,27 @@ def split_string(string):
class Plugin: class Plugin:
async def get_flatpaks(self): async def get_flatpaks(self):
def list_flatpaks(cmd): def read_proc(cmd):
flatpaks = [] proc = Popen(cmd, stdout=PIPE, stderr=None, shell=True)
flatpaks = proc.communicate()[0]
clean_env = os.environ.copy() flatpaks = flatpaks.decode("utf-8")
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 return flatpaks
global_flatpaks = list_flatpaks([ # Global flatpak list
'flatpak', 'list', '--app', '--columns=name,application' global_flatpaks = read_proc('flatpak list --app --columns="name,application" | awk \'BEGIN {FS="\\t"} {print "{\\"name\\":\\""$1"\\",\\"exec\\":\\"/usr/bin/flatpak run "$2"\\"},"}\\\'')
])
local_flatpaks = list_flatpaks([ # User flatpak list
'runuser', '-l', decky_plugin.DECKY_USER, '-c', local_flatpaks = read_proc('runuser -l '+decky_plugin.DECKY_USER+' -c \'flatpak list --app --columns="name,application"\' | awk \'BEGIN {FS="\\t"} {print "{\\"name\\":\\""$1"\\",\\"exec\\":\\"/usr/bin/flatpak run "$2"\\"},"}\\\'')
'flatpak list --app --columns=name,application'
])
seen = set() packages = global_flatpaks + local_flatpaks[:-2] # Remove trailing comma
unique_flatpaks = [] return "[" + packages + "]"
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): async def get_desktops(self):
packages = [] packages = []
for desktopFile in chain( for desktopFile in chain(
Path("/usr/share/applications").glob("*.desktop"), Path("/usr/share/applications").glob("*.desktop"),
Path(f"{decky_plugin.DECKY_USER_HOME}/.local/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(): if not desktopFile.is_file():
continue continue
@ -91,12 +58,8 @@ class Plugin:
package["name"] = line[5:] package["name"] = line[5:]
elif line.startswith("Exec="): elif line.startswith("Exec="):
foundExec = True foundExec = True
execTarget = line[5:].split(" ", 1) package["exec"] = line[5:]
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: if foundName and foundExec:
decky_plugin.logger.info("+ Desktop app: " + package["name"])
packages.append(package) packages.append(package)
break break

View file

@ -1,7 +1,7 @@
{ {
"name": "sdh-quicklaunch-anatase", "name": "sdh-quicklaunch",
"version": "1.2.1", "version": "1.2.0",
"description": "Quickly launch apps from the Steam Deck Quick Access Menu without adding them as shortcuts", "description": "Quickly Launch Apps from the Steam Deck Quick Access Menu without adding them as Shortcuts",
"scripts": { "scripts": {
"build": "shx rm -rf dist && rollup -c", "build": "shx rm -rf dist && rollup -c",
"watch": "rollup -c -w", "watch": "rollup -c -w",
@ -9,7 +9,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://gitdab.com/dj/SDH-QuickLaunch-Anatase.git" "url": "git+https://github.com/Fisch03/SDH-QuickLaunch.git"
}, },
"keywords": [ "keywords": [
"decky", "decky",
@ -17,12 +17,12 @@
"steam-deck", "steam-deck",
"deck" "deck"
], ],
"author": "Fisch03 & djsime1", "author": "Fisch03",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"bugs": { "bugs": {
"url": "https://gitdab.com/dj/SDH-QuickLaunch-Anatase/issues" "url": "https://github.com/Fisch03/SDH-QuickLaunch/issues"
}, },
"homepage": "https://gitdab.com/dj/SDH-QuickLaunch-Anatase", "homepage": "https://github.com/Fisch03/SDH-QuickLaunch#readme",
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^21.1.0", "@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",

View file

@ -1,10 +1,11 @@
{ {
"name": "Quick Launch", "name": "Quick Launch",
"author": "Fisch03 & djsime1", "author": "Fisch03",
"flags": ["root"], "flags": ["root"],
"publish": { "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.", "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" ], "tags": [ "utility" ],
"image": "https://gitdab.com/dj/SDH-QuickLaunch-Anatase/raw/branch/master/ui_full.png" "image": "https://raw.githubusercontent.com/Fisch03/SDH-QuickLaunch/master/ui_full.png"
} }
} }

1500
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,6 @@ export async function launchApp(sAPI: ServerAPI, app: App) {
SteamClient.Apps.SetShortcutName(id, `[QL] ${app.name}`) SteamClient.Apps.SetShortcutName(id, `[QL] ${app.name}`)
SteamClient.Apps.SetShortcutLaunchOptions(id, getLaunchOptions(app)) SteamClient.Apps.SetShortcutLaunchOptions(id, getLaunchOptions(app))
SteamClient.Apps.SetShortcutExe(id, `"${getTarget(app)}"`) SteamClient.Apps.SetShortcutExe(id, `"${getTarget(app)}"`)
SteamClient.Apps.SetShortcutStartDir(id, "/app/bin")
SteamClient.Apps.SpecifyCompatTool(id, app.compatTool === undefined ? "" : app.compatTool) SteamClient.Apps.SpecifyCompatTool(id, app.compatTool === undefined ? "" : app.compatTool)
setTimeout(() => { setTimeout(() => {
@ -40,7 +39,6 @@ export function createAppShortcut(sAPI: ServerAPI, app: App, settings: Settings,
SteamClient.Apps.SetShortcutName(id, app.name); SteamClient.Apps.SetShortcutName(id, app.name);
SteamClient.Apps.SetShortcutLaunchOptions(id, shortcutLaunchOptions); SteamClient.Apps.SetShortcutLaunchOptions(id, shortcutLaunchOptions);
SteamClient.Apps.SetShortcutExe(id, `"${shortcutTarget}"`); SteamClient.Apps.SetShortcutExe(id, `"${shortcutTarget}"`);
SteamClient.Apps.SetShortcutStartDir(id, "/app/bin")
SteamClient.Apps.SpecifyCompatTool(id, app.compatTool === undefined ? "" : app.compatTool); SteamClient.Apps.SpecifyCompatTool(id, app.compatTool === undefined ? "" : app.compatTool);
}, 500) }, 500)
}) })