Skip to content

Commit 8cbd0c4

Browse files
author
Rodpad
committed
Initial commit
0 parents  commit 8cbd0c4

30 files changed

Lines changed: 6671 additions & 0 deletions

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# --- Standard Ignores ---
2+
lib-cov
3+
*.seed
4+
*.log
5+
*.csv
6+
*.dat
7+
*.out
8+
*.pid
9+
*.gz
10+
*.swp
11+
*.bat
12+
13+
pids/
14+
logs/
15+
results/
16+
tmp/
17+
18+
# Coverage reports
19+
coverage/
20+
21+
# API keys and secrets
22+
.env
23+
24+
# Dependency directory
25+
node_modules/
26+
bower_components/
27+
.pnpm-store/
28+
29+
# Editors
30+
.idea/
31+
*.iml
32+
.vscode/settings.json
33+
34+
# OS metadata
35+
.DS_Store
36+
Thumbs.db
37+
38+
# Ignore built ts files
39+
dist/
40+
41+
__pycache__/
42+
43+
/.yalc
44+
yalc.lock
45+
46+
# Ignore output folder
47+
backend/out/
48+
49+
# Make sure to ignore any instance of the loader's decky_plugin.py
50+
decky_plugin.py
51+
52+
# Ignore decky CLI for building plugins
53+
out/
54+
cli/
55+
56+
# --- LeGo2 Fan Control Specifics ---
57+
# Ignore generated staging folders and archives
58+
Staged LeGo2 Fan Control/
59+
*.zip
60+
*.msi
61+
62+
# Ignore dynamically generated files
63+
AppVersion.cs
64+
license.dat
65+
settings.ini
66+
67+
# Standard .NET / Visual Studio ignores
68+
bin/
69+
obj/
70+
.vs/
71+
*.user

.vscode/build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
CLI_LOCATION="$(pwd)/cli"
3+
echo "Building plugin in $(pwd)"
4+
printf "Please input sudo password to proceed.\n"
5+
6+
# read -s sudopass
7+
8+
# printf "\n"
9+
10+
echo $sudopass | sudo -E $CLI_LOCATION/decky plugin build $(pwd)

.vscode/config.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
3+
# printf "${SCRIPT_DIR}\n"
4+
# printf "$(dirname $0)\n"
5+
if ! [[ -e "${SCRIPT_DIR}/settings.json" ]]; then
6+
printf '.vscode/settings.json does not exist. Creating it with default settings. Exiting afterwards. Run your task again.\n\n'
7+
cp "${SCRIPT_DIR}/defsettings.json" "${SCRIPT_DIR}/settings.json"
8+
exit 1
9+
else
10+
printf '.vscode/settings.json does exist. Congrats.\n'
11+
printf 'Make sure to change settings.json to match your deck.\n'
12+
fi

.vscode/defsettings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"deckip" : "steamdeck.local",
3+
"deckport" : "22",
4+
"deckuser" : "deck",
5+
"deckpass" : "ssap",
6+
"deckkey" : "-i ${env:HOME}/.ssh/id_rsa",
7+
"deckdir" : "/home/deck",
8+
"pluginname": "Example Plugin",
9+
"python.analysis.extraPaths": [
10+
"./py_modules"
11+
]
12+
}

.vscode/setup.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
PNPM_INSTALLED="$(which pnpm)"
3+
DOCKER_INSTALLED="$(which docker)"
4+
CLI_INSTALLED="$(pwd)/cli/decky"
5+
6+
# echo "$PNPM_INSTALLED"
7+
# echo "$DOCKER_INSTALLED"
8+
# echo "$CLI_INSTALLED"
9+
10+
echo "If you are using alpine linux, do not expect any support."
11+
if [[ "$PNPM_INSTALLED" =~ "which" ]]; then
12+
echo "pnpm is not currently installed, you can install it via your distro's package managment system or via a script that will attempt to do a manual install based on your system. If you wish to proceed with installing via the script then answer "no" (capitals do not matter) and proceed with the rest of the script. Otherwise, just hit enter to proceed and use the script."
13+
read run_pnpm_script
14+
if [[ "$run_pnpm_script" =~ "n" ]]; then
15+
echo "You have chose to install pnpm via npm or your distros package manager. Please make sure to do so before attempting to build your plugin."
16+
else
17+
CURL_INSTALLED="$(which curl)"
18+
WGET_INSTALLED="$(which wget)"
19+
if [[ "$CURL_INSTALLED" =~ "which" ]]; then
20+
printf "curl not found, attempting with wget.\n"
21+
if [[ "$WGET_INSTALLED" =~ "which" ]]; then
22+
printf "wget not found, please install wget or curl.\n"
23+
printf "Could not install pnpm as curl and wget were not found.\n"
24+
else
25+
wget -qO- https://get.pnpm.io/install.sh | sh -
26+
fi
27+
else
28+
curl -fsSL https://get.pnpm.io/install.sh | sh -
29+
fi
30+
fi
31+
fi
32+
33+
if [[ "$DOCKER_INSTALLED" =~ "which" ]]; then
34+
echo "Docker is not currently installed, in order build plugins with a backend you will need to have Docker installed. Please install Docker via the preferred method for your distribution."
35+
fi
36+
37+
if ! test -f "$CLI_INSTALLED"; then
38+
echo "The Decky CLI tool (binary file is just called "decky") is used to build your plugin as a zip file which you can then install on your Steam Deck to perform testing. We highly recommend you install it. Hitting enter now will run the script to install Decky CLI and extract it to a folder called cli in the current plugin directory. You can also type 'no' and hit enter to skip this but keep in mind you will not have a usable plugin without building it."
39+
read run_cli_script
40+
if [[ "$run_cli_script" =~ "n" ]]; then
41+
echo "You have chosen to not install the Decky CLI tool to build your plugins. Please install this tool to build and test your plugin before submitting it to the Plugin Database."
42+
else
43+
44+
SYSTEM_ARCH="$(uname -a)"
45+
46+
mkdir "$(pwd)"/cli
47+
if [[ "$SYSTEM_ARCH" =~ "x86_64" ]]; then
48+
49+
if [[ "$SYSTEM_ARCH" =~ "Linux" ]]; then
50+
curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-linux-x86_64"
51+
fi
52+
53+
if [[ "$SYSTEM_ARCH" =~ "Darwin" ]]; then
54+
curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-macOS-x86_64"
55+
fi
56+
57+
elif [[ "$SYSTEM_ARCH" =~ "arm64" || "$SYSTEM_ARCH" =~ "aarch64" ]]; then
58+
if [[ "$SYSTEM_ARCH" =~ "Linux" ]]; then
59+
curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-linux-aarch64"
60+
fi
61+
62+
if [[ "$SYSTEM_ARCH" =~ "Darwin" ]]; then
63+
curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-macOS-aarch64"
64+
fi
65+
66+
else
67+
echo "System Arch not found! The only supported systems are Linux x86_64/ARM64 and Apple x86_64/ARM64, not $SYSTEM_ARCH"
68+
fi
69+
70+
chmod +x "$(pwd)"/cli/decky
71+
echo "Decky CLI tool is now installed and you can build plugins into easy zip files using the "Build Zip" Task in vscodium."
72+
fi
73+
fi

.vscode/tasks.json

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
//PRELIMINARY SETUP TASKS
5+
//Dependency setup task
6+
{
7+
"label": "depsetup",
8+
"type": "shell",
9+
"group": "none",
10+
"detail": "Install depedencies for basic setup",
11+
"command": "${workspaceFolder}/.vscode/setup.sh",
12+
// // placeholder for windows scripts, not currently planned
13+
// "windows": {
14+
// "command": "call -c ${workspaceFolder}\\.vscode\\setup.bat",
15+
// },
16+
"problemMatcher": []
17+
},
18+
//pnpm setup task to grab all needed modules
19+
{
20+
"label": "pnpmsetup",
21+
"type": "shell",
22+
"group": "none",
23+
"detail": "Setup pnpm",
24+
"command": "which pnpm && pnpm i",
25+
"problemMatcher": []
26+
},
27+
//Preliminary "All-in-one" setup task
28+
{
29+
"label": "setup",
30+
"detail": "Set up depedencies, pnpm and update Decky Frontend Library.",
31+
"dependsOrder": "sequence",
32+
"dependsOn": [
33+
"depsetup",
34+
"pnpmsetup",
35+
"updatefrontendlib"
36+
],
37+
"problemMatcher": []
38+
},
39+
//Preliminary Deploy Config Setup
40+
{
41+
"label": "settingscheck",
42+
"type": "shell",
43+
"group": "none",
44+
"detail": "Check that settings.json has been created",
45+
"command": "${workspaceFolder}/.vscode/config.sh",
46+
// // placeholder for windows scripts, not currently planned
47+
// "windows": {
48+
// "command": "call ${workspaceFolder}\\.vscode\\config.bat",
49+
// },
50+
"problemMatcher": []
51+
},
52+
//BUILD TASKS
53+
{
54+
"label": "cli-build",
55+
"group": "build",
56+
"detail": "Build plugin with CLI",
57+
"command": "${workspaceFolder}/.vscode/build.sh",
58+
// // placeholder for windows logic, not currently planned
59+
// "windows": {
60+
// "command": "call ${workspaceFolder}\\.vscode\\build.bat",
61+
// },
62+
"problemMatcher": []
63+
},
64+
//"All-in-one" build task
65+
{
66+
"label": "build",
67+
"group": "build",
68+
"detail": "Build decky-plugin-template",
69+
"dependsOrder": "sequence",
70+
"dependsOn": [
71+
"setup",
72+
"settingscheck",
73+
"cli-build",
74+
],
75+
"problemMatcher": []
76+
},
77+
//DEPLOY TASKS
78+
//Copies the zip file of the built plugin to the plugins folder
79+
{
80+
"label": "copyzip",
81+
"detail": "Deploy plugin zip to deck",
82+
"type": "shell",
83+
"group": "none",
84+
"dependsOn": [
85+
"chmodplugins"
86+
],
87+
"command": "rsync -azp --chmod=D0755,F0755 --rsh='ssh -p ${config:deckport} ${config:deckkey}' out/ ${config:deckuser}@${config:deckip}:${config:deckdir}/homebrew/plugins",
88+
"problemMatcher": []
89+
},
90+
//
91+
{
92+
"label": "extractzip",
93+
"detail": "",
94+
"type": "shell",
95+
"group": "none",
96+
"command": "echo '${config:deckdir}/homebrew/plugins/${config:pluginname}.zip' && ssh ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'echo ${config:deckpass} | sudo -S mkdir -m 755 -p \"$(echo \"${config:deckdir}/homebrew/plugins/${config:pluginname}\" | sed \"s| |-|g\")\" && echo ${config:deckpass} | sudo -S chown ${config:deckuser}:${config:deckuser} \"$(echo \"${config:deckdir}/homebrew/plugins/${config:pluginname}\" | sed \"s| |-|g\")\" && echo ${config:deckpass} | sudo -S bsdtar -xzpf \"${config:deckdir}/homebrew/plugins/${config:pluginname}.zip\" -C \"$(echo \"${config:deckdir}/homebrew/plugins/${config:pluginname}\" | sed \"s| |-|g\")\" --strip-components=1 --fflags '",
97+
"problemMatcher": []
98+
},
99+
//"All-in-one" deploy task
100+
{
101+
"label": "deploy",
102+
"dependsOrder": "sequence",
103+
"group": "none",
104+
"dependsOn": [
105+
"copyzip",
106+
"extractzip"
107+
],
108+
"problemMatcher": []
109+
},
110+
//"All-in-on" build & deploy task
111+
{
112+
"label": "builddeploy",
113+
"detail": "Builds plugin and deploys to deck",
114+
"dependsOrder": "sequence",
115+
"group": "none",
116+
"dependsOn": [
117+
"build",
118+
"deploy"
119+
],
120+
"problemMatcher": []
121+
},
122+
//GENERAL TASKS
123+
//Update Decky Frontend Library, aka DFL
124+
{
125+
"label": "updatefrontendlib",
126+
"type": "shell",
127+
"group": "build",
128+
"detail": "Update @decky/ui aka DFL",
129+
"command": "pnpm update @decky/ui --latest",
130+
"problemMatcher": []
131+
},
132+
//Used chmod plugins folder to allow copy-over of files
133+
{
134+
"label": "chmodplugins",
135+
"detail": "chmods plugins folder to prevent perms issues",
136+
"type": "shell",
137+
"group": "none",
138+
"command": "ssh ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'echo '${config:deckpass}' | sudo -S chown ${config:deckuser} ${config:deckdir}/homebrew/plugins/'",
139+
"problemMatcher": []
140+
},
141+
{
142+
"label": "restartdecky",
143+
"detail": "restarts decky",
144+
"type": "shell",
145+
"group": "none",
146+
"command": "ssh ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'echo '${config:deckpass}' | sudo -S systemctl restart plugin_loader'",
147+
"problemMatcher": []
148+
},
149+
]
150+
}

0 commit comments

Comments
 (0)