foxygit / doom Log in
commit 7ab81661f913653ac04755a8c4505ce82e9d96a3
Author:     Filip Sufitchi <fsufitchi@gmail.com>
AuthorDate: Wed Feb 9 22:00:17 2022 -0500
Commit:     Filip Sufitchi <fsufitchi@gmail.com>
CommitDate: Wed Feb 9 22:00:17 2022 -0500

    Clean up devcontainer dir structure
---
 .devcontainer/.gitignore               |  4 +++-
 .devcontainer/devcontainer.json        | 11 +++++++----
 .devcontainer/initialize-linux.sh      |  9 +++++++++
 .devcontainer/prefs/NO_VERSION_CONTROL |  0
 .devcontainer/share/NO_VERSION_CONTROL |  0
 .devcontainer/wads/NO_VERSION_CONTROL  |  0
 .devcontainer/xauth-configure.sh       |  6 ------
 7 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/.devcontainer/.gitignore b/.devcontainer/.gitignore
index b324ee76..70fdefc7 100644
--- a/.devcontainer/.gitignore
+++ b/.devcontainer/.gitignore
@@ -1,2 +1,4 @@
 *.xauth
-wads/
\ No newline at end of file
+wads/
+prefs/
+share/
\ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 69a38c69..b0a38197 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,7 +1,7 @@
 // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
 // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/docker-existing-dockerfile
 {
-	"name": "Existing Dockerfile",
+	"name": "Doom Dev Container",

 	// Sets the run context to one level up instead of the .devcontainer folder.
 	"context": "..",
@@ -15,6 +15,7 @@
 	// Add the IDs of extensions you want installed when the container is created.
 	"extensions": [
 		"ms-vscode.cpptools-extension-pack",
+		"npxms.hide-gitignored",
 	],

 	// Required to not bleed "root" permission files into the volume
@@ -22,17 +23,19 @@

 	// VSCode on Linux specific, for creating X11 and sound forwarding
 	// Comment out manually if working on non-Linux
-	"initializeCommand": "sh ${localWorkspaceFolder}/.devcontainer/xauth-configure.sh ${localWorkspaceFolder}/.devcontainer/devcontainer.xauth",
+	"initializeCommand": "${localWorkspaceFolder}/.devcontainer/initialize-linux.sh",
 	"mounts": [
 		"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind",
+		"source=${localWorkspaceFolder}/.devcontainer/prefs,target=/home/chocodev/.local/share/chocolate-doom,type=bind",
 	],
 	"containerEnv": {
 		"DISPLAY": "${localEnv:DISPLAY}",
-		"XAUTHORITY": "${containerWorkspaceFolder}/.devcontainer/devcontainer.xauth",
+		"XAUTHORITY": "${containerWorkspaceFolder}/.devcontainer/share/devcontainer.xauth",
 	},
 	"runArgs": [
 		// "--gpus", "all",  // Uncomment for GPU support
-		"--device", "/dev/snd",  // TODO: pulseaudio? https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
+		"--device", "/dev/snd",
+		// TODO: pulseaudio? https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
 	]

 	// TODO: X11/sound forwarding configs for MacOS (XQuartz) and Windows (Xming)
diff --git a/.devcontainer/initialize-linux.sh b/.devcontainer/initialize-linux.sh
new file mode 100755
index 00000000..7a4275d3
--- /dev/null
+++ b/.devcontainer/initialize-linux.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+HERE=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
+
+### Create the xauth file allowing the container to interact with a forwarded X11
+XAUTH="$HERE/share/devcontainer.xauth";
+touch "$XAUTH"
+xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
+
+### TODO: pulseaudio pasthrough
\ No newline at end of file
diff --git a/.devcontainer/prefs/NO_VERSION_CONTROL b/.devcontainer/prefs/NO_VERSION_CONTROL
new file mode 100644
index 00000000..e69de29b
diff --git a/.devcontainer/share/NO_VERSION_CONTROL b/.devcontainer/share/NO_VERSION_CONTROL
new file mode 100644
index 00000000..e69de29b
diff --git a/.devcontainer/wads/NO_VERSION_CONTROL b/.devcontainer/wads/NO_VERSION_CONTROL
new file mode 100644
index 00000000..e69de29b
diff --git a/.devcontainer/xauth-configure.sh b/.devcontainer/xauth-configure.sh
deleted file mode 100644
index b6dea391..00000000
--- a/.devcontainer/xauth-configure.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# Specify arg of path to create the xauth at
-
-touch $1;
-xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $1 nmerge -