From fc3bde7e5763b22b7eb3352b74575df068d58582 Mon Sep 17 00:00:00 2001 From: zacaj Date: Sun, 2 Nov 2025 16:11:25 +0000 Subject: [PATCH 1/4] create devcontainer --- .devcontainer/.gitignore | 1 + .devcontainer/default-config.toml | 36 +++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 24 +++++++++++++++++++++ .devcontainer/init-apt.sh | 4 ++++ .devcontainer/init-go.sh | 4 ++++ .devcontainer/init-keychain.sh | 4 ++++ 6 files changed, 73 insertions(+) create mode 100644 .devcontainer/.gitignore create mode 100644 .devcontainer/default-config.toml create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/init-apt.sh create mode 100755 .devcontainer/init-go.sh create mode 100755 .devcontainer/init-keychain.sh diff --git a/.devcontainer/.gitignore b/.devcontainer/.gitignore new file mode 100644 index 0000000..87b4990 --- /dev/null +++ b/.devcontainer/.gitignore @@ -0,0 +1 @@ +custom-config.toml \ No newline at end of file diff --git a/.devcontainer/default-config.toml b/.devcontainer/default-config.toml new file mode 100644 index 0000000..e8e0366 --- /dev/null +++ b/.devcontainer/default-config.toml @@ -0,0 +1,36 @@ +[Application] +WindowWidth = 1900 +WindowHeight = 1000 + +[[Servers]] +ServerType = 'Subsonic' +Hostname = 'https://demo.navidrome.org' +AltHostname = '' +Username = 'demo' +LegacyAuth = false +ID = 'f9056891-50cc-4161-9e27-f50f3db32a8c' +Nickname = 'Navidrome Demo' +Default = true +SelectedLibrary = '' + +[[Servers]] +ServerType = 'Jellyfin' +Hostname = 'https://demo.jellyfin.org/stable' +AltHostname = '' +Username = 'demo' +LegacyAuth = false +ID = 'e9056891-50cc-4161-9e27-f50f3db32a8c' +Nickname = 'Jellyfin Demo' +Default = false +SelectedLibrary = '' + +[[Servers]] +ServerType = 'Subsonic' +Hostname = 'http://host.docker.internal:4533' +AltHostname = '' +Username = 'fillMeIn' +LegacyAuth = false +ID = 'e537432d-1875-404e-999e-591db0087052' +Nickname = 'Navidrome Localhost Example' +Default = false +SelectedLibrary = '' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0b8985f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/go . +{ + "name": "Supersonic", + "image": "mcr.microsoft.com/devcontainers/go:2-1.24-bookworm", + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "desktop-lite": { + "password": "your_password", + "webPort": "6080", + "vncPort": "5901" + } + }, + "containerEnv": { + "VNC_RESOLUTION": "1920x1080x24", + }, + "onCreateCommand": { + "log": "echo 'Starting post-create script...'", + "apt": "sudo .devcontainer/init-apt.sh", + "go": ".devcontainer/init-go.sh", + "config": "bash -c 'mkdir -p ~/.config/supersonic && (cp .devcontainer/custom-config.toml ~/.config/supersonic/config.toml 2> /dev/null || cp .devcontainer/default-config.toml ~/.config/supersonic/config.toml)'", + "keyring": "bash -c 'echo \"source $(pwd)/.devcontainer/init-keychain.sh\" >> /home/vscode/.bashrc'", + }, +} \ No newline at end of file diff --git a/.devcontainer/init-apt.sh b/.devcontainer/init-apt.sh new file mode 100755 index 0000000..64880b7 --- /dev/null +++ b/.devcontainer/init-apt.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +apt update +apt install -y libmpv-dev gcc libegl1-mesa-dev xorg-dev \ No newline at end of file diff --git a/.devcontainer/init-go.sh b/.devcontainer/init-go.sh new file mode 100755 index 0000000..c8c753d --- /dev/null +++ b/.devcontainer/init-go.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +go install fyne.io/fyne/v2/cmd/fyne@latest +go get \ No newline at end of file diff --git a/.devcontainer/init-keychain.sh b/.devcontainer/init-keychain.sh new file mode 100755 index 0000000..4f61449 --- /dev/null +++ b/.devcontainer/init-keychain.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +eval "$(dbus-launch --sh-syntax)" +eval "$(printf '\n' | gnome-keyring-daemon --unlock)" \ No newline at end of file From b1fe13ab9ca532221d62a4e09f7f9986ea422448 Mon Sep 17 00:00:00 2001 From: zacaj Date: Sun, 23 Nov 2025 16:50:04 +0000 Subject: [PATCH 2/4] move deps to Dockerfile --- .devcontainer/Dockerfile | 6 ++++++ .devcontainer/devcontainer.json | 7 +++---- .devcontainer/init-apt.sh | 4 ---- .devcontainer/init-go.sh | 4 +++- .devcontainer/init-keychain.sh | 7 +++---- .devcontainer/login.keyring | 23 +++++++++++++++++++++++ 6 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 .devcontainer/Dockerfile delete mode 100755 .devcontainer/init-apt.sh create mode 100644 .devcontainer/login.keyring diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..0533983 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM mcr.microsoft.com/devcontainers/go:2-1.24-bookworm + +RUN apt-get update && apt install -y libmpv-dev gcc libegl1-mesa-dev xorg-dev + +USER vscode +RUN go install fyne.io/fyne/v2/cmd/fyne@latest diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0b8985f..dd70d14 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,23 +2,22 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/go . { "name": "Supersonic", - "image": "mcr.microsoft.com/devcontainers/go:2-1.24-bookworm", + "dockerFile": "Dockerfile", // Features to add to the dev container. More info: https://containers.dev/features. "features": { "desktop-lite": { "password": "your_password", "webPort": "6080", "vncPort": "5901" - } + }, }, "containerEnv": { "VNC_RESOLUTION": "1920x1080x24", }, "onCreateCommand": { "log": "echo 'Starting post-create script...'", - "apt": "sudo .devcontainer/init-apt.sh", "go": ".devcontainer/init-go.sh", "config": "bash -c 'mkdir -p ~/.config/supersonic && (cp .devcontainer/custom-config.toml ~/.config/supersonic/config.toml 2> /dev/null || cp .devcontainer/default-config.toml ~/.config/supersonic/config.toml)'", - "keyring": "bash -c 'echo \"source $(pwd)/.devcontainer/init-keychain.sh\" >> /home/vscode/.bashrc'", + "keyring": "bash -c '.devcontainer/init-keychain.sh'", }, } \ No newline at end of file diff --git a/.devcontainer/init-apt.sh b/.devcontainer/init-apt.sh deleted file mode 100755 index 64880b7..0000000 --- a/.devcontainer/init-apt.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -apt update -apt install -y libmpv-dev gcc libegl1-mesa-dev xorg-dev \ No newline at end of file diff --git a/.devcontainer/init-go.sh b/.devcontainer/init-go.sh index c8c753d..cc26d04 100755 --- a/.devcontainer/init-go.sh +++ b/.devcontainer/init-go.sh @@ -1,4 +1,6 @@ #!/bin/sh -go install fyne.io/fyne/v2/cmd/fyne@latest +# handled by Dockerfile +# go install fyne.io/fyne/v2/cmd/fyne@latest + go get \ No newline at end of file diff --git a/.devcontainer/init-keychain.sh b/.devcontainer/init-keychain.sh index 4f61449..ebc7fad 100755 --- a/.devcontainer/init-keychain.sh +++ b/.devcontainer/init-keychain.sh @@ -1,4 +1,3 @@ -#!/bin/bash - -eval "$(dbus-launch --sh-syntax)" -eval "$(printf '\n' | gnome-keyring-daemon --unlock)" \ No newline at end of file +#!/bin/sh +mkdir -p /home/vscode/.local/share/keyrings +cp .devcontainer/login.keyring /home/vscode/.local/share/keyrings \ No newline at end of file diff --git a/.devcontainer/login.keyring b/.devcontainer/login.keyring new file mode 100644 index 0000000..fe238d5 --- /dev/null +++ b/.devcontainer/login.keyring @@ -0,0 +1,23 @@ +[keyring] +display-name=login +ctime=1763913973 +mtime=0 +lock-on-idle=false +lock-after=false + +[1] +item-type=0 +display-name=Password for 'f9056891-50cc-4161-9e27-f50f3db32a8c' on 'supersonic' +secret=demo +mtime=1763914175 +ctime=1763914175 + +[1:attribute0] +name=service +type=string +value=supersonic + +[1:attribute1] +name=username +type=string +value=f9056891-50cc-4161-9e27-f50f3db32a8c From 2d6c4d7d1ec1a12b4e4fe706a92c7f900e347ee3 Mon Sep 17 00:00:00 2001 From: zacaj Date: Sun, 23 Nov 2025 18:02:11 +0000 Subject: [PATCH 3/4] devcontainer: enable audio playback --- .devcontainer/Dockerfile | 3 ++- .devcontainer/devcontainer.json | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 0533983..d64ee97 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,7 @@ FROM mcr.microsoft.com/devcontainers/go:2-1.24-bookworm -RUN apt-get update && apt install -y libmpv-dev gcc libegl1-mesa-dev xorg-dev +RUN apt update && apt install -y libmpv-dev gcc libegl1-mesa-dev xorg-dev acl +RUN usermod -aG audio vscode USER vscode RUN go install fyne.io/fyne/v2/cmd/fyne@latest diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index dd70d14..5b794e2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,6 +14,14 @@ "containerEnv": { "VNC_RESOLUTION": "1920x1080x24", }, + "runArgs": [ + "--device=/dev/snd:/dev/snd", + "--group-add=audio", + ], + "postStartCommand": "sudo setfacl -m u:vscode:rw /dev/snd/*", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. "onCreateCommand": { "log": "echo 'Starting post-create script...'", "go": ".devcontainer/init-go.sh", From e4e62f76d81054c210d5d3ac0960622928270240 Mon Sep 17 00:00:00 2001 From: zacaj Date: Fri, 28 Nov 2025 18:48:41 +0000 Subject: [PATCH 4/4] add dev container docs --- .devcontainer/DEVCONTAINER.md | 29 +++++++++++++++++++++++++++++ BUILD.md | 4 ++++ CONTRIBUTING.md | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 .devcontainer/DEVCONTAINER.md diff --git a/.devcontainer/DEVCONTAINER.md b/.devcontainer/DEVCONTAINER.md new file mode 100644 index 0000000..b88284f --- /dev/null +++ b/.devcontainer/DEVCONTAINER.md @@ -0,0 +1,29 @@ +# Usage + +The Dockerfile will take care of installing all needed dependencies; all you should need to do once you enter the container is run `make` and then `./supersonic` to start it. See the Linux/Ubuntu sections of BUILD.md for more details. + +# VNC Access + +The dev container by default will open a desktop accessible via VNC at port :5901 or via web browser at :6080. + +You can use the VNC_RESOLUTION env var to adjust it if your monitors don't fit 1080p well + +supersonic can still be started via the terminal or debugger in VS Code; it will automatically open in the VNC desktop + + +# Sound + +The container is configured to forward the default `/dev/snd` card so that supersonic can access it via the default ALSA driver. + +Depending on your host system, you may need to select a different sound card than what your system is using, or configure a dummy sound card, etc, as certain audio systems require exclusive access to the hardware device and don't like to share it with the container. + +If you encounter permission issues with accessing the device, make sure your user is in the `audio` group + +# Config + +The default config (`default-config.toml`) will be copied to the proper location in the home directory. If you create a file in `.devcontainer/` named `custom-config.toml`, that will be copied instead. It's in the `.gitignore`, so you can safely put whatever changes you want in there to point at your chosen servers, etc and persist them across dev container rebuilds. + +# Future Improvements + +- Better sound integration to enable mixing with host system +- X11 forwarding instructions \ No newline at end of file diff --git a/BUILD.md b/BUILD.md index cb289ec..e6d9df8 100644 --- a/BUILD.md +++ b/BUILD.md @@ -78,3 +78,7 @@ Supersonic is available in the AUR and can be built either manually with `makepk * **Note**: The .exe dynamically links to MSYS2 libmpv dependency dlls and must be started from the MSYS2 terminal, or all dependency DLLS must be copied to the same folder as the .exe * -> If you obtain a statically built mpv-2.dll (containing all its dependencies), and rename it to libmpv-2.dll, you can place just that DLL in the same directory as the EXE, and it should run * Improvements to Windows build process will be forthcoming + +## Build instructions (dev container) + +See `.devcontainer/DEVCONTAINER.md` for more info \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 39770fd..17bc467 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,6 +10,8 @@ To set up your development environment, you need the following things: * Libmpv and development headers installed (e.g. via apt, brew, or MinGW pacman) * A Subsonic server to connect to for testing (your own server or the Navidrome demo server) +Alternately you can use a Dev Container. See `.devcontainer/DEVCONTAINER.md` for more info + ## Pull Request Process Before opening a pull request, please ensure the following things: