Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Aug 30, 2024
1 parent dcf7c6b commit 9954bd6
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 169 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/app.olivetin.sdPlugin/libs"]
path = src/app.olivetin.sdPlugin/libs
url = https://github.com/elgatosf/streamdeck-javascript-sdk
73 changes: 2 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,4 @@

# Stream Deck Plugin Template
# OliveTin-streamdeck-plugin

The `Stream Deck Plugin Template` is a template to let you get started quickly when writing a JavaScript plugin for [Stream Deck](https://docs.elgato.com/sdk/). `Stream Deck Plugin Template` requires Stream Deck 6.0 or later.

## Description

`Stream Deck Plugin Template` is a complete plugin that shows you how to

- load and save settings using Stream Deck's persistent store
- setup and communicate with the Property Inspector
- pass messages directly from Property Inspector to the plugin (and vice versa)
- localize your Property Inspector's UI to another language

## Features

- code written in Javascript
- cross-platform (macOS, Windows)
- localization support
- styled [Property Inspector](https://developer.elgato.com/documentation/stream-deck/sdk/property-inspector/) included
- Property Inspector contains all required boilerplate code to let you instantly work on your plugin's code.

## Quick Start Guide

A short guide to help you get started quickly.

### Clone the repo

```git clone https://github.com/elgatosf/streamdeck-plugin-template```

### Replace Name

Rename the folder as well as any references.

`com.elgato.template.sdPlugin` with `my.domain.plugin-name.sdPlugin`

> [!IMPORTANT]
> When sym-linking the plugin, the folder name must end with `.sdPlugin`.
### Get the latest library

You can either clone the javascript library or add it as a submodule to your repository.

#### Clone

```git clone https://github.com/elgatosf/streamdeck-javascript-sdk src/my.domain.plugin-name/libs```

#### Add Submodule

```git submodule add https://github.com/elgatosf/streamdeck-javascript-sdk src/my.domain.plugin-name/libs```

### Start Coding

You can get started in app.js!

```javascript
const myAction = new Action('com.elgato.template.action');

/**
* The first event fired when Stream Deck starts
*/
$SD.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) => {
console.log('Stream Deck connected!');
});

myAction.onKeyUp(({ action, context, device, event, payload }) => {
console.log('Your key code goes here!');
});

myAction.onDialRotate(({ action, context, device, event, payload }) => {
console.log('Your dial code goes here!');
});
```
This is in very early development!
24 changes: 24 additions & 0 deletions src/app.olivetin.sdPlugin/actions/StartAction/assets/appImage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,27 @@
<div type="tabs" class="sdpi-item">
<div class="sdpi-item-label empty"></div>
<div class="tabs">
<div class="tab selected" data-target="#tab1" title="Show some inputs">Inputs</div>
<div class="tab" data-target="#tab2" title="Here's some text-areas">Text</div>
</div>
<div class="tab selected" data-target="#tabConnection" title="Connection details">Connection</div>
<div class="tab" data-target="#tabAction" title="Show some inputs">Inputs</div>
</div>
</div>
<hr class="tab-separator">
<form id="property-inspector">
<div id="tab1" class="tab-container">
<div id="tabConnection" class="tab-container">
<div class="sdpi-item">
<div data-localize class="sdpi-item-label" title="My name">Name</div>
<input data-localize class="sdpi-item-value" name="name" type="text" value="" placeholder="Click Me" />
<div data-localize class="sdpi-item-label" title="More">OliveTin API URL</div>
<input data-localize class="sdpi-item-value" name="url" type="text" value="" placeholder="http://olivetin.example.com:1337/api/" />
</div>

<div type="textarea" class="sdpi-item">
<div class="sdpi-item-label" data-localize title="My message">Message</div>
<div class="sdpi-item-value textarea">
<textarea
name="message"
type="textarea"
maxlength="50"
class="three-lines"></textarea>
</div>
</div>
</div>
<div id="tab2" class="tab-container">
</div>
<div id="tabAction" class="tab-container">
<div class="sdpi-item">
<div data-localize class="sdpi-item-label" title="More">More</div>
<input data-localize class="sdpi-item-value" name="more" type="text" value="" placeholder="More info" />
<div data-localize class="sdpi-item-label" title="My name">Action ID</div>
<input data-localize class="sdpi-item-value" name="action_id" type="text" value="" placeholder="hello_world" />
</div>
</div>
</div>
</form>
<div class="sdpi-item">
<div class="sdpi-item-label" data-localize title="My button">Button</div>
<div class="sdpi-item-label" data-localize title="My button">Test Connection</div>
<button
class="sdpi-item-value"
value="Click Me"
Expand All @@ -57,7 +46,7 @@
Click Me
</button>
</div>
</div>
</div>

<div class="sdpi-info-label hidden" style="top: -1000" value=""></div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>com.elgato.template</title>
<title>OliveTin Stream-Deck Plugin</title>
<meta charset="utf-8"/>
<style>
canvas {
Expand Down
45 changes: 45 additions & 0 deletions src/app.olivetin.sdPlugin/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/// <reference path="libs/js/action.js" />
/// <reference path="libs/js/stream-deck.js" />

const startAction = new Action('app.olivetin.actions.start');

$SD.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) => {
console.log('Stream Deck connected! 9');
console.log("sa", startAction)
});

startAction.onKeyUp(({ action, context, device, event, payload }) => {
console.log(action)

const settings = payload.settings

const startActionArgs = {
actionId: settings.action_id,
arguments: []
}

console.log("sa args", startActionArgs)

fetch(settings.url + 'StartAction', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(startActionArgs)
}).then(res => {
if (res.ok) {
return res.json()
} else {
console.log("then err", res)
throw new Error(res)
}
}).catch(err => {
throw err
})
});

const killAction = new Action("app.olivetin.actions.kill")

killAction.onKeyUp(() => {
console.log("Kill")
});
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Description": "Use this to create your own plugin",
"Name": "Stream Deck Template",
"Category": "Templates",
"com.elgato.template.action": {
"Name": "OliveTin Stream-Deck Plugin",
"Category": "OliveTin",
"app.olivetin.StartAction": {
"Name": "Action",
"Tooltip": "This is the only action in this plugin"
},
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/app.olivetin.sdPlugin/libs
Submodule libs added at 64da8f
53 changes: 53 additions & 0 deletions src/app.olivetin.sdPlugin/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"SDKVersion": 2,
"Author": "James Read",
"CodePath": "app.html",
"Description": "OliveTin Streamdeck plugin",
"Name": "OliveTin Plugin",
"Icon": "actions/template/assets/action",
"URL": "https://docs.olivetin.app/stream-deck.html",
"Version": "1.0.0",
"Software": {
"MinimumVersion": "5.0"
},
"OS": [
{
"Platform": "mac",
"MinimumVersion": "10.11"
},
{
"Platform": "windows",
"MinimumVersion": "10"
}
],
"Category": "OliveTin",
"CategoryIcon": "actions/StartAction/assets/appImage",
"Actions": [
{
"UUID": "app.olivetin.actions.start",
"Name": "Start OliveTin Action",
"Tooltip": "Starts an OliveTin action",
"PropertyInspectorPath": "actions/StartAction/property-inspector/inspector.html",
"Controllers": ["Keypad"],
"Icon": "actions/StartAction/assets/appImage",
"States": [
{
"Image": "actions/StartAction/assets/buttonImage"
}
]
},
{
"UUID": "app.olivetin.actions.kill",
"Name": "Kill OliveTin Action",
"Tooltip": "Kills an OliveTin action",
"PropertyInspectorPath": "actions/StartAction/property-inspector/inspector.html",
"Controllers": ["Keypad", "Encoder"],
"Icon": "actions/StartAction/assets/appImage",
"States": [
{
"Image": "actions/StartAction/assets/buttonImage"
}
]
}
]
}
Loading

0 comments on commit 9954bd6

Please sign in to comment.