All Projects → magicmonkey → go-streamdeck

magicmonkey / go-streamdeck

Licence: MIT license
Go interface to an Elgato Streamdeck

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-streamdeck

deckmaster
An application to control your Elgato Stream Deck on Linux
Stars: ✭ 106 (+140.91%)
Mutual labels:  elgato, streamdeck, elgato-stream-deck
streamdeck-cpu
Stream Deck SDK: CPU sample plugin
Stars: ✭ 103 (+134.09%)
Mutual labels:  elgato, streamdeck, elgato-stream-deck
ElgatoLegacy
Use your Elgato Stream Deck on Windows 7, 8 and 8.1!
Stars: ✭ 25 (-43.18%)
Mutual labels:  elgato, streamdeck, elgato-stream-deck
streamdeck-plugintemplate
Stream Deck SDK: Plugin Template
Stars: ✭ 211 (+379.55%)
Mutual labels:  elgato, streamdeck, elgato-stream-deck
streamdeck-stopwatch
C# Stopwatch implementation for the Elgato Stream Deck device
Stars: ✭ 20 (-54.55%)
Mutual labels:  streamdeck, elgato-stream-deck
kiwi
Kiwi turns your Pimoroni Keybow into a fully customizable poor-man's Elgato Stream Deck!
Stars: ✭ 40 (-9.09%)
Mutual labels:  elgato, elgato-stream-deck
streamDeck-weatherPlugin
Popular Stream Deck plugin for Weather reporting
Stars: ✭ 24 (-45.45%)
Mutual labels:  elgato, elgato-stream-deck
streamdeck-stockticker
Stock Ticker plugin for Stream Deck
Stars: ✭ 29 (-34.09%)
Mutual labels:  streamdeck, elgato-stream-deck
streamdeck-discord-message
A Stream Deck plugin that sends a message to a Discord channel.
Stars: ✭ 26 (-40.91%)
Mutual labels:  streamdeck, elgato-stream-deck
AutoHotStreamDeck
An AutoHotkey wrapper for interacting with the Elgato Stream Deck
Stars: ✭ 57 (+29.55%)
Mutual labels:  streamdeck, elgato-stream-deck
streamdeck-unity
Enables Stream Deck integration with Unity.
Stars: ✭ 22 (-50%)
Mutual labels:  streamdeck, elgato-stream-deck
StreamDeckMonitor
Customizable C# app to display Real-Time System Statistics on the Elgato 'Stream Deck' Device
Stars: ✭ 36 (-18.18%)
Mutual labels:  elgato, streamdeck
streamdeck keyboard maestro
A Streamdeck plugin for Keyboard Maestro integration
Stars: ✭ 20 (-54.55%)
Mutual labels:  streamdeck
streamdeck
Golang API for the Corsair / Elgato StreamDeck
Stars: ✭ 46 (+4.55%)
Mutual labels:  streamdeck
KMlink
Streamdeck plugin to drive Keyboard Maestro
Stars: ✭ 100 (+127.27%)
Mutual labels:  streamdeck
ESP8266-HomeKit-Air-Quality-Sensor-Elgato-Eve-Room
ESP8266 based  Homekit Indoor Air Quality sensor that acts like Eve Room🌱
Stars: ✭ 58 (+31.82%)
Mutual labels:  elgato
icalbuddy-km-and-stream-deck
Use icalBuddy and Keyboard Maestro to show calendar events on Stream Deck
Stars: ✭ 40 (-9.09%)
Mutual labels:  streamdeck
node-elgato-stream-deck
A Node.js library for interfacing with the Elgato Stream Deck. https://julusian.github.io/node-elgato-stream-deck/
Stars: ✭ 89 (+102.27%)
Mutual labels:  elgato
python-homeassistant-streamdeck
Python client to control a HomeAssistant instance using an Elgato Stream Deck controller.
Stars: ✭ 42 (-4.55%)
Mutual labels:  streamdeck
homebridge-keylights
Yet another Homebridge plugin for Elgato Key Light and Key Light Air. https://homebridge.io
Stars: ✭ 40 (-9.09%)
Mutual labels:  elgato

Go Streamdeck

A Go interface to an Elgato Streamdeck (currently works with the 32-button XL only because that's what I have).

GoDoc

Designed for and tested with Ubuntu, Go 1.13+ and a Streamdeck XL. Images are the wrong size for other streamdecks; bug reports and patches are welcome!

Installation

Either include the library in your project or install it with the following command:

go get github.com/magicmonkey/go-streamdeck

On Linux, you might also need to add some udev rules. Put this into /etc/udev/rules.d/99-streamdeck.rules:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="666"

Usage

There are 2 ways to use this: the low-level "comms-oriented" interface (using streamdeck.Open) which wraps the USB HID protocol, or the higher-level "button-oriented" interface (using streamdeck.New) which represents buttons and actions.

If you want to implement your own actions, I suggest that you either instantiate a CustomAction or alternatively implement the ButtonActionHandler interface (basing your code on the CustomAction).

Example high-level usage

High level usage gives some helpers to set up buttons. This example has a few things to look at:

  • A button in position 2 that says "Hi world" and prints to the console when pressed

  • A button in position 7 displaying the number 7 - changes to number 8 when pressed.

  • A yellow button in position 26

  • A purple button in position 27, it changes colour and prints to the console when pressed.

import (
	"image/color"
	"time"

	streamdeck "github.com/magicmonkey/go-streamdeck"
	"github.com/magicmonkey/go-streamdeck/actionhandlers"
	"github.com/magicmonkey/go-streamdeck/buttons"
	_ "github.com/magicmonkey/go-streamdeck/devices"
)

func main() {
	sd, err := streamdeck.New()
	if err != nil {
		panic(err)
	}

	// A simple yellow button in position 26
	cButton := buttons.NewColourButton(color.RGBA{255, 255, 0, 255})
	sd.AddButton(26, cButton)

	// A button with text on it in position 2, which echoes to the console when presesd
	myButton := buttons.NewTextButton("Hi world")
	myButton.SetActionHandler(&actionhandlers.TextPrintAction{Label: "You pressed me"})
	sd.AddButton(2, myButton)

	// A button with text on it which changes when pressed
	myNextButton := buttons.NewTextButton("7")
	myNextButton.SetActionHandler(&actionhandlers.TextLabelChangeAction{NewLabel: "8"})
	sd.AddButton(7, myNextButton)

	// A button which performs multiple actions when pressed
	multiActionButton := buttons.NewColourButton(color.RGBA{255, 0, 255, 255})
	thisActionHandler := &actionhandlers.ChainedAction{}
	thisActionHandler.AddAction(&actionhandlers.TextPrintAction{Label: "Purple press"})
	thisActionHandler.AddAction(&actionhandlers.ColourChangeAction{NewColour: color.RGBA{255, 0, 0, 255}})
	multiActionButton.SetActionHandler(thisActionHandler)
	sd.AddButton(27, multiActionButton)

	time.Sleep(20 * time.Second)
}

The program runs for 20 seconds and then exits.

Example low-level usage

The low-level usage gives more control over the operations of the streamdeck and buttons.

This example shows an image on any pressed button, updating each time another button is pressed.

import streamdeck "github.com/magicmonkey/go-streamdeck"

func main() {
	sd, err := streamdeck.Open()
	if err != nil {
		panic(err)
	}
	sd.ClearButtons()

	sd.SetBrightness(50)

	sd.ButtonPress(func(btnIndex int, sd *streamdeck.Device, err error) {
		if err != nil {
			panic(err)
		}
		sd.ClearButtons()
		sd.WriteImageToButton("play.jpg", btnIndex)
	})

	time.Sleep(20 * time.Second)

}

The program runs for 20 seconds and then exits.

Showcase

Projects using this library (pull request to add yours!)

Contributions

This is a very new project but all feedback, comments, questions and patches are more than welcome. Please get in touch by opening an issue, it would be good to hear who is using the project and how things are going.

For more, see CONTRIBUTING.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].