Monday, July 18, 2022

Quick Hack: The Phone to Stream Deck Conversion

What do you do with those old Android or iPhone phones and tablets? You have plenty of options, but it is pretty easy to build your own stream deck with a little off-the-shelf software. What’s a stream deck, you ask? The name comes from its use as a controller for a live-streaming setup, but essentially, it’s an LCD touchscreen that can trigger things on your computer.

The software I’m using, Deckboard, is a server for Windows or Linux and, of course, an Android app. The app is free with some limitations, but for under $4 you can buy the full version. However, even the free version is pretty capable. You can use an Android phone or tablet and you can connect to the PC with a USB cable or WiFi. I’ve found that even with WiFi, it is handy to keep the phone charged, so realistically you are going to have a cable, but it doesn’t necessarily have to connect to the host computer.

Linux Setup

Setup is very easy. The biggest hurdle is you might need to set up your firewall to allow the server to listen on port 8500 with TCP.  There are a few small issues when installing with Linux that you might want to watch out for.  There are 32-bit and 64-bit versions in deb, tar.gz, and appimage format. There’s also a snap. The problem with the snap is it is sandboxed, so without effort you can’t easily launch programs, which is kinda the entire point. I finally removed it and installed the deb file which was fine.

There were still two other wrinkles. First, while Deckboard offers a way to launch programs, it must be a program from a list it reads from your system. That would be acceptable, but the list wasn’t complete. I never did figure out why some things show up on the list and others don’t. For example, GIMP which shows up on my application menu was absent. Yet other things that were fairly obscure didn’t show up.

I thought this might be a dealbreaker until I found that Deckboard has a well-developed plugin system and one of those plugins lets you run an arbitrary command line. I guess it is a little less convenient, but it is much more flexible since you can launch any program you want and provide options to it as well.

The only other complaint I had is that when you run the program, it shows its configuration interface and puts itself in the system tray. That’s great the first time you run it, but on system startup, it would be nice to just have it quietly start. If there’s an option for that I haven’t found it. I’ll tell you how I solved that later, but, for now, just live with it.

Configuration

Of course, getting it installed on both machines is only the start. The whole point of something like this is to configure it to your whim. The program knows how to communicate with OBS, Spotify, Twitter, and Twitch. But you can also add generic programs, URLs, and so on. There are also plugins for things like Discord, Open Hardware Monitor, Steam, and more.

The multimedia panel lets me control media and open a few apps

You can create a bunch of pages, so you don’t have to cram everything on one page. The free version limits how many buttons you can have on a page, but the upgrade lets you put way too many if you want. I found that three rows of 6 buttons in landscape mode on my old Pixel 2 XL was about right for me.

Of course, everyone will have different ideas about how to set it up, and you are probably better able to create something aesthetic than I am. However, I tried to keep a few things constant. The top right corner of each screen is a time button that doesn’t do anything, just shows the tim). This requires a plug in. The rest of the top row is reserved for buttons that open other pages and on every screen but the main screen, the button next to the clock takes you back to main.

Creating a new button is easy enough

The bottom right button on each screen opens a multimedia panel because it is just so useful. Again, you won’t like my setup and will want your own.

Creating buttons and pages is very easy on the PC. You can select actions ranging from keyboard macros to multimedia control. You can control the mouse, open a website, or take a screenshot. Of course, you can also run a program as I mentioned earlier.

Form and Function

Graphic buttons can make your deck look better but getting there isn’t obvious

My buttons are a bit bland, I’ll admit. The icons are built into the program and come from Font Awesome. However, I didn’t realize that you can make each button use your own custom graphic. You do this by selecting the button’s shape which can be square, round, or a mysterious third option that looks like an image. At first, I thought that just meant “totally transparent” but if you select that and then push the button in the edit window, it lets you pick a file for a background. I guess I’ll have to go reconfigure everything now that I know that.

One thing that is nice is that you can have a button do multiple actions. So, for example, when I press the Hackaday button, it not only switches to the Hackaday page on the deck, it also flips over to my Hackaday desktop on the PC by sending a keyboard command. It could also run a script or folder, too.

Buttons can run more than one action

It isn’t quite a scripting language, but it prevents you from having to tie buttons to a bash script in some cases.

The Final Piece

I mentioned that I didn’t appreciate that loading the program on startup also causes the main window to appear. I found a fairly simple way to combat that, at least on KDE. First, run the program minimized. You can do that a few ways. I used a KWIN window rule to force it to iconify, but you could also use kstart to do that. Of course, if you aren’t using KDE, you’ll have to find another way to do it and, honestly, it doesn’t really matter if you don’t mind seeing the config screen pop up for a bit on startup. That’s because in addition to setting the program to autostart, I also started a script file called deckboard-tidy.sh:


#!/bin/bash
sleep 5
wmctrl -c deckboard

In other words, wait for the program to start and then close its window. It still stays running in the systemtray. You could also tell Deckboard not to load itself and then do the whole loading operation in this script. You can probably pull the same stunt on other desktops, but the details will depend on your setup.

Honestly, this is a hack that is more useful than it is difficult. But you can spend a lot of time tweaking that perfect setup. But it makes that old phone something you can use every day.

If you prefer a more rigorous hack, check out FreeDeck. Not that that’s the only one out there. If you want a really useful hack, it would be nice to reverse engineer Deckboard’s TCP protocol so we could have a Raspberry Pi server for this.



from iphone hacks – Hackaday

No comments:

Post a Comment