Skip to content

Instantly share code, notes, and snippets.

@flexiondotorg
Last active September 19, 2022 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save flexiondotorg/753034f12b65a0c9f5892028cc909437 to your computer and use it in GitHub Desktop.
Save flexiondotorg/753034f12b65a0c9f5892028cc909437 to your computer and use it in GitHub Desktop.
Install StreamDeck Unix on Ubuntu
#!/usr/bin/env bash
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR! Must be root."
exit 1
fi
export GOPATH="/tmp/go"
if [ -d "${GOPATH}" ]; then
rm -rf "${GOPATH}"
fi
mkdir -p "${GOPATH}/src"
cat << 'EOF' > /etc/udev/rules.d/99-streamdeck.rules
SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0090", MODE:="666", GROUP="plugdev"
EOF
sudo udevadm control --reload-rules
# The driver: https://github.com/unix-streamdeck/streamdeckd
apt -y install golang-go libusb-1.0-0-dev xdotool
cd /tmp/go/src
git clone --recursive https://github.com/unix-streamdeck/streamdeckd.git --branch v1.0.2
cd streamdeckd
go build
go install
# The UI: https://github.com/unix-streamdeck/streamdeckui
apt -y install libglfw3 libxxf86vm-dev libgl1-mesa-dev xorg-dev zenity
cd /tmp/go/src
git clone --recursive https://github.com/unix-streamdeck/streamdeckui --branch v1.0.1
cd streamdeckui
go build
go install
find "${GOPATH}/bin/" -type f -executable | while read -r EXECUTABLE; do
install -DT "${EXECUTABLE}" "/usr/local/bin/$(basename "${EXECUTABLE}")"
done
# Remove the now obsolete old systemd unit
if [ -e /usr/lib/systemd/user/streamdeckd.service ]; then
systemctl --user disable streamdeckd
rm -f /usr/lib/systemd/user/streamdeckd.service
fi
mkdir -p /usr/local/share/icons/hicolor/256x256/apps/ 2>/dev/null
wget -q "https://cdn.jsdelivr.net/gh/pauby/ChocoPackages@f08050f3/icons/streamdeck.png" -O /usr/local/share/icons/hicolor/256x256/apps/streamdeckui.png
mkdir -p /usr/local/share/applications 2>/dev/null
cat << 'EOF' > /usr/local/share/applications/streamdeckui.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=StreamDeck Editor
Comment=StreamDeck Unix Editor
Exec=/usr/local/bin/streamdeckui
Icon=/usr/local/share/icons/hicolor/256x256/apps/streamdeckui.png
Terminal=false
Categories=Utility;
EOF
cat << 'EOF' > /etc/xdg/autostart/streamdeckd.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=streamdeckd
Comment=StreamDeck Unix Daemon
Exec=/usr/local/bin/streamdeckd
Terminal=false
NoDisplay=true
EOF
update-desktop-database /usr/local/share/applications/
rm -rf "${GOPATH}"
echo
echo "streamdeckd will autostart when logging in via /etc/xdg/autostart/streamdeckd.desktop"
echo "To start streamdeckd:"
echo " /usr/local/bin/streamdeckd &"
echo
echo "To restart streamdeckd:"
echo " pkill streamdeckd && /usr/local/bin/streamdeckd &"
echo
echo "NOTE! If you just installed streamdeckd for the first time, unplug and plugin your StreamDeck now."
@ymauray
Copy link

ymauray commented Nov 20, 2021

Now that the driver has been updated - but not yet released -, you can replace the download sections with:

# The driver
go install github.com/unix-streamdeck/streamdeckd@1bafcbd

# The UI: 
apt -y install libglfw3 libxxf86vm-dev libgl1-mesa-dev xorg-dev zenity
go install github.com/unix-streamdeck/streamdeckui@latest

Once the driver is released, go install github.com/unix-streamdeck/streamdeckd@latest should do the trick.

@ymauray
Copy link

ymauray commented Nov 20, 2021

You may also want to add mkdir -p /usr/local/share/applications before the creation of the desktop file, on my brand new Ubuntu MATE install the folder didn't exist.

@ymauray
Copy link

ymauray commented Nov 20, 2021

Last one for today: wouldn't it make more sense to make a local systemd service? That way, every use could have its own config, using the same device. Spoiler: that's what I did on machine.

@flexiondotorg
Copy link
Author

You may also want to add mkdir -p /usr/local/share/applications before the creation of the desktop file, on my brand new Ubuntu MATE install the folder didn't exist.

Fixed that. Thanks 👍

@popey
Copy link

popey commented Nov 22, 2021

This fails to launch for me, with the daemon running.

$ streamdeckui 
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running, locked to thread]:
main.newEditor({0x0, 0x0, 0x0}, {0x7f8680, 0xc00043e000})
        /tmp/go/src/streamdeckui/ui.go:39 +0x30d
main.main()
        /tmp/go/src/streamdeckui/main.go:28 +0x195

@flexiondotorg
Copy link
Author

@popey I think we tracked that down to needing to unplug/plugin the StreamDeck after this script ran, right?

@popey
Copy link

popey commented Nov 30, 2021

@flexiondotorg yeah, that did it.

@flexiondotorg
Copy link
Author

@ymauray I've updated the script to use upstream streamdeckd with the new driver changes. I've also dropped the systemd unit in favour of XDG autostart so that streamdeckd is automatically started for any user logging into a desktop session.

@popey I've added text at the end of the script that first time installs may require the StreamDeck to be replugged.

@flexiondotorg
Copy link
Author

Updated the script now that streamdeckd 1.0.2 is released.

@ymauray
Copy link

ymauray commented Dec 16, 2021

If you really want to latest of the latest, with support for the upcoming pre-releases of the OBS plugin and the plugin that shall not be talked about just yet, you may want to use this part to install the driver and the UI:

# The driver: https://github.com/unix-streamdeck/streamdeckd
apt -y install golang-go libusb-1.0-0-dev xdotool
go install github.com/unix-streamdeck/streamdeckd@78b7a80

# The UI: https://github.com/frenchguych/streamdeckui
apt -y install libglfw3 libxxf86vm-dev libgl1-mesa-dev xorg-dev zenity
cd "${GOPATH}/src"
git clone --recursive https://github.com/frenchguych/streamdeckui --branch feature/select_field_type
cd streamdeckui
go build
go install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment