Skip to content

Commit

Permalink
chore(plugin): initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
pandomic committed Dec 4, 2024
0 parents commit bbdf182
Show file tree
Hide file tree
Showing 39 changed files with 8,366 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
tags:
- '*'

name: Upload Release Asset

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v4
node-version: '20'
- name: Install Dependencies
run: make install
- name: Build
run: make build
- name: Validate
run: make build
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: com.vlad-gramuzov.stream-deck-stateful-executor.sdPlugin
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Node.js
node_modules/

# Stream Deck files
*.sdPlugin/bin
*.sdPlugin/logs

# IDEs
.idea/
.vscode/

# OS specific
.DS_Store

# Built plugin
*.streadDeckPlugin
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
install:
npm install;

build-templates:
npx mustache \
-p src/ui/action_settings_template.mustache \
-p src/ui/matcher_template.mustache \
src/ui/data.json src/ui/execution_template.mustache \
> com.vlad-gramuzov.stream-deck-stateful-executor.sdPlugin/ui/execution.html;

validate:
streamdeck validate com.vlad-gramuzov.stream-deck-stateful-executor.sdPlugin;

build: build-templates
npm run build;
streamdeck pack com.vlad-gramuzov.stream-deck-stateful-executor.sdPlugin;

.PHONY: install build-templates build
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Stream Deck Stateful Executor

Stateful Executor is the automation plugin for your Stream Deck, enabling execution of HTTP Requests, Apple Shortcuts, Terminal Commands, Shell Scripts with dynamic button state updates based on execution results.

## Configuration

### General Settings

* `Enable success indicator`: displays the default success indicator when the execution completes without errors. This indicator does take matchers into account.

Note that the error indicator is intentionally not configurable, as it is always shown when the execution fails.

### Icons and Titles

> TLDR; if you set icons/titles on the plugin level, make sure to leave the icons/titles empty in Stream Deck's UI (set to default)
> IMPORTANT: when using custom icons, place them in a permanent location, as they are referenced by path.
* If you pick an icon or a title using the default Stream Deck's UI, the first icon would represent the matched state, and the second icon would represent the unmatched state FOR ALL MATCHERS. Note that any customization made on the plugin level of the icons/titles would not work in this case.
* If you want to have more states just leave icons/titles blank (set to default) and configure them through the plugin's configuration.

### Actions

#### Action triggers

* `Click`: runs the action on button click
* `Polling`: runs the action every `n` seconds, where `n` is the polling interval. The polling action will wait the action to finish before running the next one.

You can combine both triggers, but polling will have a higher presentation priority.

#### Action types

* `request`: executes HTTP request. Use JSON-parsable output if you want to use matchers with requests.
* `shortcut (MacOS only)`: executes Apple Shortcut. Use `Dictionary` output if you want to use matchers with shortcuts.
* `terminal`: executes terminal command. Make sure to use JSON-parsable output if you want to use matchers with terminal commands.
* `script`: executes shell script. Make sure to use JSON-parsable output if you want to use matchers with shell scripts.
* `shell binary`: the shell binary to use for executing the script. Defaults to `/bin/bash`. You can experiment with other binaries, such as python, node, etc.
* `script path`: the path to the script to execute. The script should be executable and have the appropriate shebang.

### Matchers

> Matchers currently can only be used with JSON results. Ensure your actions produce JSON-parsable outputs.
* `Field`: dot-notated json path to the property used for matching. For example, if the output is `{"status": "ok"}`, the field would be `status`.
* `Operator`: the operator to use for matching. Note strings and numbers have different operators.
* `Value`: the value to match against.
* `State Title`: Custom title to use when the matcher is matched.
* `State Icon`: Custom icon path to use when the matcher is matched.
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.
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.
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.
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.
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
@@ -0,0 +1,54 @@
{
"Name": "Stateful Executor",
"Version": "0.1.0.0",
"Author": "Vlad Gramuzov",
"Actions": [
{
"Name": "Execution",
"UUID": "com.vlad-gramuzov.stream-deck-stateful-executor.execution",
"Icon": "imgs/icons/execution",
"Tooltip": "Executes selected action",
"PropertyInspectorPath": "ui/execution.html",
"DisableAutomaticStates": true,
"Controllers": [
"Keypad"
],
"States": [
{
"Name": "Matched",
"Image": "imgs/actions/matched",
"TitleAlignment": "bottom"
},
{
"Name": "Unmatched",
"Image": "imgs/actions/unmatched",
"TitleAlignment": "bottom"
}
]
}
],
"Category": "Stateful Executor",
"CategoryIcon": "imgs/plugin/category-icon",
"CodePath": "bin/plugin.js",
"Description": "Execute HTTP Requests, Apple Shortcuts, Terminal Commands, and Shell Scripts with dynamic button state updates based on execution results",
"Icon": "imgs/plugin/marketplace",
"SDKVersion": 2,
"Software": {
"MinimumVersion": "6.4"
},
"OS": [
{
"Platform": "mac",
"MinimumVersion": "10.15"
},
{
"Platform": "windows",
"MinimumVersion": "10"
}
],
"Nodejs": {
"Version": "20",
"Debug": "enabled"
},
"UUID": "com.vlad-gramuzov.stream-deck-stateful-executor"
}
Loading

0 comments on commit bbdf182

Please sign in to comment.