steamdeckhomebrew / decky-loader Goto Github PK
View Code? Open in Web Editor NEWA plugin loader for the Steam Deck.
Home Page: https://decky.xyz
License: GNU General Public License v2.0
A plugin loader for the Steam Deck.
Home Page: https://decky.xyz
License: GNU General Public License v2.0
Hi, was using the PowerTools plugin, it crashed the Performance Overlay and had to restart my Deck, now the plugin is gone, the files are on the homebrew folder but it's not showing up on the Plugins section. It just reads "No plugins installed"
Just going to leave this idea here, if we're already running this plugin manager service in system-d we should hook it into D::BUS to allow for some IPC. I think we could probably provide this type of messaging by having some optional properties in the JS Plugin Type and managing the D::BUS calls/responses in the actual Rust code. I would be interested to hear your feedback, I'm working on the application side right now and having functionality like this would benefit quite a few projects.
The other outstanding thing noted here is it looks like plugins are limited to JS code, I wonder can we use native extensions/bindings by default (I would assume not?)
This plugin loader is really cool, and will likely get reinstalled at some point in the near future, but I'm looking to uninstall it while I wait out some of the more frustrating lockups that I've had with non-steam emulated games.
How would I uninstall the Plugin Loader from my Steam Deck, preferably without a reset?
Thanks!
Use a folder structure such as
plugins/
my_plugin/
main.py
tile_view.html
main_view.html
One of the caveats of PluginLoader currently is that 'You can only interact with the Plugin Menu via touchscreen." Is it technically possible to implement navigation by d-pad, or is this a limitation that will be hard or impossible to work around?
I'm curious why this is being done. My best guess is it's for analytics / tracking reasons (which github provides to you already, though with a bit more privacy for the users).
I would recommend hosting the file in the git repo and replacing the command with a link to it, honestly.
I might be misunderstanding the point of "hot reload", because my interpretation comes from Hot Module Replacement in Javascript, but why are the folder and files getting write disabled when the plugin loader starts?
Currently I'm trying to use a remote VSCode instance on the steam deck while it's in gaming mode to create the plugin on my PC, and I keep running into permission errors while trying to make changes. I'm logged in as the deck
user to make these changes.
What is the hot reload flag supposed to mean in the config.json
of the plugin?
"flags": [
"_hot_reload",
]
I have an image in my plugin folder which I'm trying to to show in Steam, however I found out that loading an image (or probably any non-text based asset) returns a 500 server error due to the backend trying to decode it as utf-8 text.
Example:
http://127.0.0.1:1337/plugins/plugin_resource/1650910504.3644676/image.jpg
returns 500 server error
http://127.0.0.1:1337/plugins/plugin_resource/1650910504.3644676/main_view.html
shows the HTML page as text.
The image is located in ~/homebrew/plugins/my_plugin/image.jpg
This is the error message I got from journalctl
:
Apr 25 21:11:34 steamdeck PluginLoader[33099]: [loader][INFO]: <module 'posixpath' from '/tmp/_MEI0WN3n2/posixpath.pyc'>
Apr 25 21:11:34 steamdeck PluginLoader[33099]: [web_protocol][ERROR]: Error handling request
Apr 25 21:11:34 steamdeck PluginLoader[33099]: Traceback (most recent call last):
Apr 25 21:11:34 steamdeck PluginLoader[33099]: File "aiohttp/web_protocol.py", line 435, in _handle_request
Apr 25 21:11:34 steamdeck PluginLoader[33099]: File "aiohttp/web_app.py", line 504, in _handle
Apr 25 21:11:34 steamdeck PluginLoader[33099]: File "loader.py", line 152, in handle_sub_route
Apr 25 21:11:34 steamdeck PluginLoader[33099]: File "codecs.py", line 322, in decode
Apr 25 21:11:34 steamdeck PluginLoader[33099]: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
The request I have is to allow the server to serve non-text based static assets.
Plugins folder has wrong permissions, which wont let you write/paste anything into the folder.
Even if the plugin.json file does not contain the "root" flag, the plugin seems to be loaded as root. I added the following to the top of the main.py file on a plugin without the root flag,
import os
f = open("/home/deck/media-controls-log", "a")
f.write(os.getenv("USER"))
f.close()
And the file contained root
.
This seems to be the change which made the daemon run as root at startup
7aa4e91#diff-
That may be expected, if so maybe what is failing is starting the plugin as the "deck" user if the flag is not there within https://github.com/SteamDeckHomebrew/PluginLoader/blob/7d74e98f4f8a47daac85b5de1ef6aa29a1637c06/plugin_loader/main.py
To get all users to the newest release there should be a check on startup if the loader is up to date. When it isn't just run the install command.
Hi,
I wrote it, because adding form interface doesn't worked few days ago for me. I think it can be useful for others:
#!/bin/sh
chmod -R 750 ~/homebrew
cd ~/homebrew/plugins
for i in SteamDeckHomebrew/Mopidy-Controller SteamDeckHomebrew/ExtraSettingsPlugin SpyrexDE/SDH-BigPictureMode SpyrexDE/SDH-Calculator NegativeI0N/SDH-ClassicTheme SteamDeckHomebrew/ExtraSettingsPlugin NGnius/PowerTools suchmememanyskill/SDH-CssLoader; do
echo "refetching: $i"
rm -rf "$HOME/homebrew/plugins/basename $i
"
git clone --recursive "https://github.com/$i"
done
Sometimes, when calling two Python functions at the same time from Javascript, the result of one will be returned by the other.
This is likely caused by the id of the calls being the same, since both are generated at (nearly) the same instant.
Rough reproduction/example:
call_plugin_method("function1", {}).then(x => {
document.getElementById("foo1").innerText = x.toString()
});
call_plugin_method("function2", {}).then(y => {
document.getElementById("foo2").innerText = y.toString()
});```
Hey can you please make a script for holoiso ?
[mva@mva ~]$ sudo curl -L https://github.com/SteamDeckHomebrew/PluginLoader/raw/main/dist/install_release.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1202 100 1202 0 0 2313 0 --:--:-- --:--:-- --:--:-- 2313
Installing Steam Deck Plugin Loader release...
sudo: unknown user deck
sudo: error initializing audit plugin sudoers_audit
sudo: unknown user deck
sudo: error initializing audit plugin sudoers_audit
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
Warning: Failed to create the file /home/deck/homebrew/services/PluginLoader:
Warning: No such file or directory
0 8482k 0 879 0 0 1242 0 1:56:33 --:--:-- 1:56:33 1242
curl: (23) Failure writing output to destination
chmod: cannot access '/home/deck/homebrew/services/PluginLoader': No such file or directory
Created symlink /etc/systemd/system/multi-user.target.wants/plugin_loader.service → /etc/systemd/system/plugin_loader.service.
[mva@mva ~]$
Once enabled, the systemd service exits at system startup with status=1/FAILURE and no further info.
If I manually start the service, it will say
Started SteamDeck Plugin Manager:
Available Content:
MainMenu
Toast
data:text/html,<body><%2fbody>
QuickAccess
data:text/html,<body>
SP
{"id":1,"result":{"type":"undefined"}}}
plugin_manager.service: Deactivated successfully.
pid 6469 != 5676, skipping destruction (fork without exec?)
And when I open the QuickAccess menu, the system becomes completely unresponsive until I hold the power button to bring up the menu and then the QA menu goes away.
I don't have any plugins installed.
EDIT: After rebooting the device again and running sudo systemctl status plugin_manager
I see the error:
× plugin_manager.service - SteamDeck Plugin Manager
Loaded: loaded (/etc/systemd/system/plugin_manager.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2022-04-01 17:02:12 EDT; 3min 12s ago
Process: 901 ExecStart=/home/deck/homebrew/services/plugin_manager/plugin_manager (code=exited, status=1/FAILURE)
Main PID: 901 (code=exited, status=1/FAILURE)
CPU: 4ms
Apr 01 17:02:12 steamdeck systemd[1]: Started SteamDeck Plugin Manager.
Apr 01 17:02:12 steamdeck plugin_manager[901]: Error: hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }))
Apr 01 17:02:12 steamdeck systemd[1]: plugin_manager.service: Main process exited, code=exited, status=1/FAILURE
Apr 01 17:02:12 steamdeck systemd[1]: plugin_manager.service: Failed with result 'exit-code'.
I've also tried adding the template_plugin.js file to the plugin directory and once I enable the plugin manager I don't see it in the list and tapping "A" to enter the plugin manager list freezes the system.
Probably already known:
When the plugin menu is entered by pressing the "a"-button there is no way to get out of the menu, except using the touchscreen. When inside a plugin view ("main_view_html") even the touch screen method does not work and you have to toggle sleep mode off and on again.
Being able to press the "b"-button when a plugin view is opened to bring the user back to the plugin menu as well as being able to leave the plugin menu would be the optimal solution.
Title describes it all. I have to restart the entire device to be able to select a different plugin.
I'm going to assume that this is related to issues with html/js and the hard-coded steam controls.
I also can't enable sshd using the extra-settings plugin but that's not the focus of this issue.
Testing out the new version, it seems to detect plugins but when you go down to the Plugin menu and either click the A button or moving the Thumbstick right to select an option, the whole Deck UI freezes requiring a suspend and reload to get it working again.
Not really sure how to provide any logs on this one.
Testing with the music plugin: https://github.com/Philip-Scott/media-controls-plugin (since there's no demo plugin)
Edit: happens with no plugins installed too
Hi, your instructions say:
Open a Terminal and type systemctl --now --user enable plugin_manager
But the file is named plugin_loader
I think the instructions definitely need some love.
Place the executable under ~/homebrew/services/plugin_loader. Do not change the name of the file.
You don't say what executable?
There's also no step telling people to run the installer file, which needs sudo. To copy the service file over, it also needs sudo.
Title should be "Link to**"
It's a bit tedoous trying to find the plugin store when you're not directly on the steam deck, such as looking on your phone for the specific github page for a plugin. It would be a lot easier if there was a link in the ReadMe
I followed this guide to install homebrew on my steamdeck: https://gist.github.com/uyjulian/105397c59e95f79f488297bb08c39146
However, I still have no ~/homebrew directory. I figured out that there is a linuxbrew directory but this one does not have a "service" folder.
For plugins which provide extra functionality to other plugins or just run in the background with no aim to expose any UI to a user.
Unless I am missing something, the project is currently unlicensed. Could you please add a proper license so people who help out will know what to expect? :)
Hi, by default the homebrew folder and subfolders in /home/ only has the ability to view content.
This needs to be adjusted so the user can actually interact with them, and put the plugins into the folder.
It would make a lot more sense to implement some type of RPC api then have client implementations in various languages that can be used for writing plugins.
This would be helpful when for example javascript code is not fully executed yet or should work in the background.
Looks like developing a plugin with node_modules inside of the plugins folder can cause the loader to die a bit on the inside 😆 I'm not sure what the best solution could be here.... Should we allow passing in either an watch or ignore lists to the hot-reloader? I'm open for suggestions and could help implement either option here :)
OSError: [Errno 24] Too many open files
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/deck/PluginLoader/plugin_loader/loader.py", line 194, in refresh_iframe
await tab.open_websocket()
File "/home/deck/PluginLoader/plugin_loader/injector.py", line 20, in open_websocket
File "/usr/lib/python3.10/site-packages/aiohttp/client.py", line 776, in _ws_connect
File "/usr/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
If anyone else were to hit this, you can disable hot-reloading from the main.py file :)
It would be useful for installation and updating if users could simply enter a url to a github or gitlab repository to install a plugin.
on new (stable) firmware:
see:
https://old.reddit.com/r/SteamDeck/comments/uzgmiv/steamos_locks_up_after_pressing_quick_access/
I have experienced extended hangs on QAM appearing after you press the ... button, as well as hangs on the new firmware (system needed to be hard powered down).
Dont have a perfect way to replicate, but launching retroarch and playing paper mario (n64) in mupen64plus-next with glide64 after an hour or so playing (maybe shorter, causes those long delays on qam appearing or until it becomes responsive , without a fault).
So seems worse over time (maybe?) So memory leak?
When running the command mentioned in the readme to get started with development, instead of prompting for input, it just prints various errors and exits immediately.
curl -L https://github.com/SteamDeckHomebrew/PluginLoader/raw/react-frontend-plugins/contrib/deck.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 9388 100 9388 0 0 14840 0 --:--:-- --:--:-- --:--:-- 14840
Installing Steam Deck Plugin Loader contributor (for Steam Deck)...
THIS SCRIPT ASSUMES YOU ARE RUNNING IT ON A PC, NOT THE DECK!
Not planning to contribute to PluginLoader?
If so, you should not be using this script.
If you have a release/nightly installed this script will disable it.
This script requires you to have nodejs installed. (If nodejs doesn't bundle npm on your OS/distro, then npm is required as well).
Enter the directory in /home/user to clone to.
Example: if your home directory is /home/user you would type: git
The clone directory would be: /root/git
Folder name not provided. Using default, 'git'.
Enter the directory in /home/user to install to.
Example: if your home directory is /home/user you would type: loaderdev
The install directory would be: /root/loaderdev
Folder name not provided. Using default, 'loaderdev'.
An ip address must be provided, exiting.
I don't know what's causing it, but at random the Plugins menu just doesn't appear.
Sometimes a Deck restart will make it appear but not always.
What can I do to help you figure out why this is happening?
Only major question is between automatic updates or user-prompting before installing a new update.
Installed this via instructions including PowerTools. Whenever I access the menu the Steam Deck freezes and no commands work. I hold the power button to surpress the menu and then it works again.
I would say this was PowerTools but also happened when PowerTools wasn't installed.
Only odd thing about installation was that the Plugins folder was read only so I had to change the permissions.
Any idea of what this could be?
Thank you.
Was wondering if these small changes could be done to improve navigability between the repo, community plugins listing and the plugin repos?
I was able to get the plugin loader installed, rebooted into gaming mode, and I successfully installed power tools and set lower GPU, etc. settings last night. However, I didn't try to turn on my deck again until this morning and it would just hang on a black screen. I tried the hard reset, going into bios and selecting the boot device (only the 1 SSD) but it wasn't until I plugged into an outlet that I was able to get something to run. Unfortunately, it was just the OS reimager.
I tried a few different things but basically I suspect that this error I saw somehow really messed something up on the backend. After running the curl command and entering my sudo password, I ran systemctl status plugin_loader and journalctl -xe to see the following error repeated every second:
PluginLoader93386]: [main][INFO]: Failed to inject JavaScript into tab.
I also saw this log on journalctl once in a while, but it may be unrelated:
(yellow text) pipewire[1196]: spa.alsa: hw:acp5x,1: follower delay:576 target:256 thr:256, resync
I have gone through installing plugin loader multiple times this morning (3-4 reimages) testing out various things. I thought maybe it was because manually setting the wattage/GPU clock super low caused desktop mode to struggle. But the last time, I left everything on default and only did the following things: Login after reimage -> update SteamOS -> reboot -> developer mode and enable CEF remote debugging -> set hostname -> reboot -> desktop mode then switch to gaming mode -> desktop mode, set sudo, install script and check status/journalctl -> uninstall and switch to gaming mode. I have isolated it to this plugin as much as I could because I have been using the steam deck for about 4 days before I added the plugin loader and I had no issues until this morning. No bricking from the uninstall after install suggests that the install process is what bricks my steam deck. It could just be faulty hardware for me if nobody else is even seeing the failure in their logs. It just seems weird that it played nice with SteamOS enough for me to install the loader and the power tools plugin and then decided to brick.
closed by #58
Probably need to run basicConfig and set levels and formatting
It makes more sense to have the homebrew folder be located in ~/.local/share as that is where most programs put theirs (including Steam). It is also a lot tidier in my opinion.
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
I am in the process of writing a small plugin that reads some infos and stats created by my own launcher script.
However, I noticed that when the plugin was activated and you close the side menu once you open it again later the displayed information is not updated.
I fixed that with a setTimeout but that just seems wrong.
Is there a possibility to trigger the onload event again or is there even a better method I have overlooked?
I am currently running the beta branch on my Steam Deck and am working on a plugin to add performance presets to the UI.
But, before I could even start I am unable to get the plugin loader menu up and running.
I have a password setup for my user account if that might effect anything. Happy to help in any way I can.
I followed the plugin loader install instructions and have added the mopidy-controller plugin and the extra settings plugin but not even the plugin menu appears.
EDIT: Just noticed an update that I hadn't even realized had released. Switching over to stable to see if this improves anything.
Since the CI tool builds a python executable and that is what gets shipped, this file contains the dependencies required to run the Plugin Loader. However, it appears to be unable to read other external dependencies even if they are already installed to the Deck user using pip.
[loader][ERROR]: Could not load /home/deck/homebrew/plugins/music-plugin/main.py. No module named 'dbus'
This does not seem to be a systemd issue, as if systemd starts a bash script such as the following, the music plugin will load correctly.
#!/bin/bash
python3 /home/deck/PluginLoader/plugin_loader/main.py
Might seem a bit stupid, but when I delete the plugin through sudo, I have a big "Server error 500" showing inside the plugin tab bar, any idea how to cleanly remove the plugins?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.