From 995165d58bca00a24c35e1a737b769374160e896 Mon Sep 17 00:00:00 2001 From: Zack Hoherchak Date: Mon, 28 Feb 2022 16:31:38 -0500 Subject: [PATCH] Added category icon, renamed StreamDeck --- README.md | 2 +- .../actions/template/property-inspector/inspector.js | 8 ++++---- src/com.elgato.template.sdPlugin/app.js | 6 ++---- .../libs/js/dynamic-styles.js | 2 +- src/com.elgato.template.sdPlugin/libs/js/stream-deck.js | 4 ++-- src/com.elgato.template.sdPlugin/manifest.json | 1 + 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fb45b1d..d64d217 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ A short guide to help you getting started quickly. You can get starting in app.js! ```javascript -streamDeck.onConnected(({actionInfo, appInfo, connection, messageType, port, uuid}) => { +$SD.onConnected(({actionInfo, appInfo, connection, messageType, port, uuid}) => { const myAction = new Action('my.domain.plugin.action'); myAction.onKeyUp(({action, context, device, event, payload}) => { diff --git a/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js b/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js index c2c10d6..ca50f14 100644 --- a/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js +++ b/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js @@ -1,8 +1,8 @@ /// /// -StreamDeck.onConnected((jsn) => { - StreamDeck.loadLocalization('../../../'); +$SD.onConnected((jsn) => { + $SD.loadLocalization('../../../'); const form = document.querySelector('#property-inspector'); const { actionInfo, appInfo, connection, messageType, port, uuid } = jsn; @@ -15,8 +15,8 @@ StreamDeck.onConnected((jsn) => { 'input', Utils.debounce(150, () => { const value = Utils.getFormValue(form); - StreamDeck.sendToPlugin(value, context); - StreamDeck.setSettings(value); + $SD.sendToPlugin(value, context); + $SD.setSettings(value); console.log(value); }) ); diff --git a/src/com.elgato.template.sdPlugin/app.js b/src/com.elgato.template.sdPlugin/app.js index 12f7604..8c63f76 100644 --- a/src/com.elgato.template.sdPlugin/app.js +++ b/src/com.elgato.template.sdPlugin/app.js @@ -4,7 +4,7 @@ /** * The first event fired when Stream Deck starts */ -StreamDeck.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) => { + $SD.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) => { // TODO: Remove this test logging code and replace with simple action console.log({ object: 'stream-deck', event: 'onConnected' }); @@ -43,7 +43,7 @@ StreamDeck.onConnected(({ actionInfo, appInfo, connection, messageType, port, uu console.log({ object: 'action', event: 'onSendToPropertyInspector' }); }); - StreamDeck.onDeviceDidConnect(() => { + $SD.onDeviceDidConnect(() => { console.log({ object: 'stream-deck', event: 'onDeviceDidConnect' }); }) .onDeviceDidDisconnect(() => { @@ -53,11 +53,9 @@ StreamDeck.onConnected(({ actionInfo, appInfo, connection, messageType, port, uu console.log({ object: 'stream-deck', event: 'onSendToPropertyInspector' }); }) .onApplicationDidLaunch(() => { - // TODO: figure out why this event does not fire console.log({ object: 'stream-deck', event: 'onApplicationDidLaunch' }); }) .onApplicationDidTerminate(() => { - // TODO: figure out why this event does not fire console.log({ object: 'stream-deck', event: 'onApplicationDidTerminate' }); }) .onSystemDidWakeUp(() => { diff --git a/src/com.elgato.template.sdPlugin/libs/js/dynamic-styles.js b/src/com.elgato.template.sdPlugin/libs/js/dynamic-styles.js index 6f17830..5560dc3 100644 --- a/src/com.elgato.template.sdPlugin/libs/js/dynamic-styles.js +++ b/src/com.elgato.template.sdPlugin/libs/js/dynamic-styles.js @@ -8,7 +8,7 @@ const fadeColor = function (col, amt) { return '#' + (g | (b << 8) | (r << 16)).toString(16).padStart(6, 0); }; -StreamDeck.onConnected(({ appInfo }) => { +$SD.onConnected(({ appInfo }) => { if (appInfo?.colors) return; const clrs = appInfo.colors; const node = document.getElementById('#sdpi-dynamic-styles') || document.createElement('style'); diff --git a/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js b/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js index 07d46dd..0368c2b 100644 --- a/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js +++ b/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js @@ -368,7 +368,7 @@ class ELGSDStreamDeck { } } -var StreamDeck = new ELGSDStreamDeck(); +var $SD = new ELGSDStreamDeck(); /** * connectElgatoStreamDeckSocket @@ -381,5 +381,5 @@ var StreamDeck = new ELGSDStreamDeck(); * @param {string} actionInfo - Context is an internal identifier used to communicate to the host application. */ function connectElgatoStreamDeckSocket() { - StreamDeck.connect(arguments); + $SD.connect(arguments); } diff --git a/src/com.elgato.template.sdPlugin/manifest.json b/src/com.elgato.template.sdPlugin/manifest.json index 7e890d4..236d423 100644 --- a/src/com.elgato.template.sdPlugin/manifest.json +++ b/src/com.elgato.template.sdPlugin/manifest.json @@ -21,6 +21,7 @@ } ], "Category": "Template Plugin", + "CategoryIcon": "actions/template/assets/actionimage", "Actions": [ { "Icon": "actions/template/assets/actionimage",