Update README with code changes from v0.7.0

This commit is contained in:
NGnius (Graham) 2022-07-10 14:20:34 -04:00
parent 01bf335a9a
commit 860933d975

View file

@ -4,7 +4,7 @@
Steam Deck power tweaks for power users. Steam Deck power tweaks for power users.
This is generated from the template plugin for the [SteamOS Plugin Loader](https://github.com/SteamDeckHomebrew/PluginLoader). This is generated from the template plugin for the [Decky Plugin Loader](https://github.com/SteamDeckHomebrew/decky-loader).
You will need that installed for this plugin to work. You will need that installed for this plugin to work.
## What does it do? ## What does it do?
@ -74,6 +74,8 @@ Get the design battery capacity: `cat /sys/class/hwmon/hwmon2/device/charge_full
Get whether the deck is plugged in: `cat /sys/class/hwmon/hwmon5/curr1_input` gives the charger current in mA. Get whether the deck is plugged in: `cat /sys/class/hwmon/hwmon5/curr1_input` gives the charger current in mA.
NOTE: 7.7 is the voltage of the battery -- it's not just a magic number.
### Steam Deck kernel patches ### Steam Deck kernel patches
This is how I figured out how the fan stuff works. This is how I figured out how the fan stuff works.
@ -82,22 +84,26 @@ https://lkml.org/lkml/2022/2/5/391
### Game launch detection ### Game launch detection
The biggest limitation right now is it can't detect a game closing -- only opening -- and only after PowerTools is looked at at least once (per SteamOS restart). ```typescript
//@ts-ignore
From a plugin, this can be accomplished by running some front-end Javascript. let lifetimeHook = SteamClient.GameSessions.RegisterForAppLifetimeNotifications((update) => {
if (update.bRunning) {
```javascript console.log("AppID " + update.unAppID.toString() + " is now running");
await execute_in_tab("SP", false, } else {
`SteamClient.Apps.RegisterForGameActionStart((actionType, data) => { console.log("AppID " + update.unAppID.toString() + " is no longer running");
console.log("start game", appStore.GetAppOverviewByGameID(data)); // game exit code here
});` // NOTE: custom games always have 0 as AppID, so AppID is bad to use as ID
); }
});
//@ts-ignore
let startHook = SteamClient.Apps.RegisterForGameActionStart((actionType, id) => {
//@ts-ignore
let gameInfo: any = appStore.GetAppOverviewByGameID(id);
// game start code here
// NOTE: GameID (variable: id) is always unique, even for custom games, so it's better to use than AppID
});
``` ```
In PowerTools, the callback (the part surrounded by `{` and `}`, containing `console.log(...)`) sends a message to a local HTTP server to notify the PowerTools back-end that a game has been launched.
If you go to `http://127.0.0.1:5030` on your Steam Deck with PowerTools >=0.6.0, you can see some info about the last game you launched.
## License ## License
This is licensed under GNU GPLv3. This is licensed under GNU GPLv3.