How I use Stream Deck on Linux with open source tools

Stream Deck is not just a keypad full of shiny buttons; it's a customizable workhorse that makes it easier to manage your video streams.
139 readers like this.
Working from home at a laptop

Most of us have gotten a lot more familiar with working from home this year. In my role as a developer advocate, this has meant a lot less travel and a lot more video work, including streaming on Twitch.

As I transitioned to working and streaming video from home in spring 2020, I decided to get a Stream Deck, but I wasn't exactly sure what I'd use it for.

The Stream Deck is a keypad that makes it easier to manage your video streaming. You can customize its buttons to do things like switching scenes, adjusting audio, inserting media, interacting with viewers, and much more. I got the 32-button version because that's all that was in stock anywhere when I bought it.

Six months in, it's become my best desk accessory. I want to introduce you to it and share my current setup.

Stream Deck software for Linux

Stream Deck offers several software options for driving the device, but I'm on Ubuntu Linux, so the official Stream Deck tools aren't an option. I found a Python graphical user interface (GUI), but it really just mapped shell scripts onto buttons; since I don't use a mouse, I found the interface pretty awkward.

Instead, I glued together a lovely selection of open source libraries and created a rather weird and knobbly Golang application that perfectly suits my needs. That sounds like the hard way to drive some perfectly good hardware. Perhaps it is, but now that it's finished, it fits me perfectly, and I love it! I'm going to claim it's not purely a "works-on-my-machine" solution because it works on both of my Thinkpads running Ubuntu.

Meet my Stream Deck

My setup is still changing weekly, but here's how it looks in November 2020. The top row is Open Broadcaster Software (OBS) integration; the second row is mainly bot/chat integration and window-focusing with a bonus screenshot button on the end; row three holds the lighting controls and a little bit of Twitch API integration; and the bottom row has sound effects and the all-important mute button. If you'd like a bit more detail, read on.

Start with streaming

It's a Stream Deck; the clue is in the name! So I began by adding some integration with OBS, the program I use to stream. OBS has a plugin to support WebSockets, and there was already a library for Golang, which really helped. Crucially, the library also handles events, so I have buttons that select scenes and a little indicator to show which scene is active—even if I change scenes via OBS rather than the Stream Deck.

Using the Stream Deck to change scenes is amazing when you're screen-sharing because it means you don't have to focus on another window while you're in the middle of something.

Window management

Window focus—keeping all the right things visible and everything else not visible—is definitely a huge challenge when streaming. Let's just say that I had to rotate a lot of keys in the first few months of my streaming journey!

There's a lot to look at, between OBS, probably some chat/moderation/events, the stream itself… you get the idea. My setup's buttons focus on the applications I use the most while streaming (they call a mixture of wmctrl and gtk-launch), and it has made things much easier to operate. I have one button for OBS, one for stream manager, and one for my featured chat dashboard (the last two are web pages packaged to make them standalone apps using Nativefier). Now my streams are more about the topics I have in mind, rather than mostly showing Alt+Tab.

I can absolutely imagine using this for other day-to-day applications, such as if you regularly rotate among a set of applications and want the ability to conjure one up immediately. I'm using browser tabs in a known order for this purpose, but I feel I have missed an opportunity for a productivity hack here.

The bot and the clipboard

I stream a bunch of different technologies, and my geeky audience asks a lot of questions and recommends a lot of tools, which is brilliant. However, that means I spent a lot of time finding and focusing on the chat window (and the text box within that window) to share links. To improve this, I switched the channel bot to Nightbot, a chatbot that adds moderation and other features to a stream's chat function. Many bots are available, but I chose this one because it has API integration and buttons to help me get things into chat when I need them.

The first two buttons cue things up. I often paste URLs into my streams, but I don't want to risk accidentally pasting a password. So the cue button first cues up what I have in my clipboard (shout out to Clipboard for Go for the clipboard integration) and shows it to me. The other cue button reads the next line from a file I keep of things I might want to share on a stream—maybe I want to mention an event where I'm speaking that I think the crowd would like, or I know I'm going to promote a particular tool on the stream that day—and shows me what it's going to send. I can press the cue button again to see another line from the file.

The Send button causes the bot to "chat" the cued-up text into my channel. This is a much better setup than searching for a chat window when you are mid-spiel about a topic.

Lights and sounds

I'm not the only streamer with funky, changeable light colors in the background of my streaming location, and having control over them is very useful. The shelf that sits behind me has a custom groove for a strip of neopixels. My Stream Deck has buttons to turn the lights on and off and implement some color presets. Everything works over MQTT, and I use the Eclipse Paho client in Go to control it all. Another button on the Stream Deck turns my video light on and off so that I can get everything set up and cue the lights when I'm ready to stream, rather than blinding myself when I'm not live. I will happily admit to flipping the LED strip colors as a sort of video meeting party trick or even when nobody is watching! Buttons to press and colorful lights… what's not to like?

I also have sound effects on my Stream Deck, but I haven't made cute icons for those buttons yet. Technology-wise, I'm running CasterSoundboard, which supports the Open Sound Control protocol, and using the hypebeast/osc library in my application to wrangle it. I have a few different sounds; they make me (and hopefully others!) smile. I have seen some really engaging sound effects on streams, but I think I'm at a beginner stage so far!

Non-streaming buttons

There are not many other features on my Stream Deck, but those are the ones I use the most, by far, usually when I'm not streaming. The first is a screenshot button. I write a lot of technical documentation, and sometimes that means I need to create screenshots. Having a one-press button that captures the current window in two seconds is very useful, and I am so happy with it. The button activates the command I'd use for this:

/usr/bin/gnome-screenshot -w -d 2

Finally, something I never want to part with: a microphone mute button. It mutes at the system level via pulsemixer, and it shows an indicator of the device's current state. I'm writing this in 2020, when video calling is my primary human contact. Since many platforms don't have a way to hover or click to get to the mute icon, having control of my sound device like this is fabulous. Lots of video calling applications will pick up these settings and show you as muted when you are and unmuting when you want to make an important point. Sometimes the smallest things are the most life-changing!

Give it a go

There are many features I use daily, and not just when I'm streaming. I have had a lot of fun dreaming up improvements and features for the Stream Deck and sometimes streaming while I implement them.

There are some features that I wouldn't want to live without now. If you're on the fence about getting a device like this, I'd recommend giving it a go. There are lots of great libraries to help you make it your own.

What to read next
User profile image.
Lorna is based in Yorkshire, UK; she is a polyglot programmer as well as a published author and experienced conference speaker. She brings her technical expertise on a range of topics to audiences all over the world with her writing and speaking engagements, always delivered with a very practical slant.

1 Comment

Great article.
Do I get it right that the StreamDeck is connected to the computer via USB? And that the computer then sees this as a HID, just like a special keyboard that sends "key presses" that are not in the "normal" range of a keyboard?

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.