Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6f5dc01876 |
|||
|
|
f912f491e2 |
||
|
|
13d5c3c75e | ||
|
|
105cbaffb6 |
6 changed files with 881 additions and 716 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
|
||||
|
||||
|
|
@ -8,4 +11,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)
|
||||
|
||||
## Caveats
|
||||
You can only have one application open at at time
|
||||
You can only have one application open at at time
|
||||
|
|
|
|||
59
main.py
59
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,27 +26,58 @@ def split_string(string):
|
|||
|
||||
class Plugin:
|
||||
async def get_flatpaks(self):
|
||||
def read_proc(cmd):
|
||||
proc = Popen(cmd, stdout=PIPE, stderr=None, shell=True)
|
||||
flatpaks = proc.communicate()[0]
|
||||
flatpaks = flatpaks.decode("utf-8")
|
||||
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 flatpak list
|
||||
global_flatpaks = read_proc('flatpak list --app --columns="name,application" | awk \'BEGIN {FS="\\t"} {print "{\\"name\\":\\""$1"\\",\\"exec\\":\\"/usr/bin/flatpak run "$2"\\"},"}\\\'')
|
||||
global_flatpaks = list_flatpaks([
|
||||
'flatpak', 'list', '--app', '--columns=name,application'
|
||||
])
|
||||
|
||||
# User flatpak list
|
||||
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"\\"},"}\\\'')
|
||||
local_flatpaks = list_flatpaks([
|
||||
'runuser', '-l', decky_plugin.DECKY_USER, '-c',
|
||||
'flatpak list --app --columns=name,application'
|
||||
])
|
||||
|
||||
packages = global_flatpaks + local_flatpaks[:-2] # Remove trailing comma
|
||||
return "[" + packages + "]"
|
||||
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
|
||||
|
|
@ -58,8 +91,12 @@ 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
|
||||
|
||||
|
|
|
|||
14
package.json
14
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "sdh-quicklaunch",
|
||||
"version": "1.2.0",
|
||||
"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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1598
pnpm-lock.yaml
generated
1598
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
|
@ -10,6 +10,7 @@ export async function launchApp(sAPI: ServerAPI, app: App) {
|
|||
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(() => {
|
||||
|
|
@ -39,6 +40,7 @@ export function createAppShortcut(sAPI: ServerAPI, app: App, settings: Settings,
|
|||
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)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue