added dev container

This commit is contained in:
Wil Taylor 2023-02-15 20:34:21 +10:00
parent 0b5e5a2f6e
commit c3fec697ed
No known key found for this signature in database
GPG Key ID: CC778972B0954AF7
13 changed files with 288 additions and 0 deletions

1
.devcontainer/.obsidian/app.json vendored Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,3 @@
{
"accentColor": ""
}

View File

@ -0,0 +1 @@
[]

View File

@ -0,0 +1,29 @@
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": true,
"backlink": true,
"canvas": true,
"outgoing-link": true,
"tag-pane": true,
"page-preview": true,
"daily-notes": true,
"templates": true,
"note-composer": true,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"starred": true,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false
}

View File

@ -0,0 +1,20 @@
[
"file-explorer",
"global-search",
"switcher",
"graph",
"backlink",
"canvas",
"outgoing-link",
"tag-pane",
"page-preview",
"daily-notes",
"templates",
"note-composer",
"command-palette",
"editor-status",
"starred",
"outline",
"word-count",
"file-recovery"
]

1
.devcontainer/.obsidian/hotkeys.json vendored Normal file
View File

@ -0,0 +1 @@
{}

143
.devcontainer/.obsidian/workspace.json vendored Normal file
View File

@ -0,0 +1,143 @@
{
"main": {
"id": "1da4c00dbfe5bced",
"type": "split",
"children": [
{
"id": "65770a19d36ce4d7",
"type": "tabs",
"children": [
{
"id": "c55c99abfa4b5f70",
"type": "leaf",
"state": {
"type": "empty",
"state": {}
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "b0b6b73c526db39b",
"type": "split",
"children": [
{
"id": "6af39779272f93a4",
"type": "tabs",
"children": [
{
"id": "32904b86a6cf0b2e",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
}
},
{
"id": "7961081ff83371c3",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
},
{
"id": "0dd23160fd18b40e",
"type": "leaf",
"state": {
"type": "starred",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "6a50534ac1b00289",
"type": "split",
"children": [
{
"id": "a63b1511024a2947",
"type": "tabs",
"children": [
{
"id": "1b1bc2edfef7e9b1",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "0483ba3a5012ff27",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "d44292d9a49da8d1",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
}
},
{
"id": "c1f38a906ff052f7",
"type": "leaf",
"state": {
"type": "outline",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false
}
},
"active": "c55c99abfa4b5f70",
"lastOpenFiles": []
}

9
.devcontainer/README.md Normal file
View File

@ -0,0 +1,9 @@
# Obsidian Development Container
To use this container you have the following options:
- Install the Dev Container plugin in Visual Studio code and it will allow you to boot into a development container.
- Load the container on github code spaces.
Once the container has starte you can access Obsidian via the ports tab on the terminal window. If you select novnc it will open a
desktop environment with a vanilla Obsidian install you can test your plugins on.
To start obsidian you can just run Obsidian from the menu in the bottom left or `Obsidian` from the terminal.

View File

@ -0,0 +1,30 @@
{
"name": "Obsidian Dev",
"image": "mcr.microsoft.com/vscode/devcontainers/universal",
"features": {
"ghcr.io/devcontainers/features/desktop-lite:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers/features/common-utils:2": {}
},
//Set the OB_VERSION environment variable if you want to get a specific version.
//Otherwise it will just grab the latest release version.
/*"containerEnv": {
//"OB_VERSION": "1.1.9"
},*/
"forwardPorts": [6080],
"privileged": true,
"portsAttributes": {
"6080": {
"label": "noVNC",
"onAutoForward": "openPreview",
"protocol": "http"
}
},
"onCreateCommand": "./.devcontainer/getObsidian.sh",
"postStartCommand": "./.devcontainer/postStart.sh",
"customizations": {
"vscode": {
"extensions": ["ms-vscode.vscode-typescript-next", "editorconfig.editorconfig", "esbenp.prettier-vscode"]
}
}
}

15
.devcontainer/getObsidian.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
if [[ -z "$OB_VERSION" ]] ; then
# PUll the latest version of Obsidian if its not specified.
JSON=$(curl -Ss https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/desktop-releases.json)
OB_VERSION=$(echo $JSON | jq -r '.latestVersion')
fi
sudo apt-get update -y
sudo apt-get install fuse firefox -y
sudo wget -O /bin/Obsidian https://github.com/obsidianmd/obsidian-releases/releases/download/v$OB_VERSION/Obsidian-$OB_VERSION.AppImage
sudo chmod +x /bin/Obsidian
cp .devcontainer/menu ~/.fluxbox/menu

10
.devcontainer/menu Normal file
View File

@ -0,0 +1,10 @@
[begin] ( Application Menu )
[exec] (Obsidian) { /bin/Obsidian } <>
[exec] (File Manager) { nautilus ~ } <>
[exec] (Text Editor) { mousepad } <>
[exec] (Terminal) { tilix -w ~ -e $(readlink -f /proc/$$/exe) -il } <>
[exec] (Web Browser) { firefox } <>
[submenu] (System) {}
[exec] (Set Resolution) { tilix -t "Set Resolution" -e bash /usr/local/bin/set-resolution } <>
[end]
[end]

View File

@ -0,0 +1 @@
{"vaults":{"95a79339294e3474":{"path":"/home/codespace/vault","ts":1676451456265,"open":true}}}

25
.devcontainer/postStart.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
WORKSPACE="$(realpath $PWD)"
PLUGIN_NAME="$(basename $PWD)"
# Fix issue with gtk file picker being to big.
gsettings set org.gtk.Settings.FileChooser window-size "(800, 600)"
gsettings set org.gtk.Settings.FileChooser window-position '(0,0)'
# You will want to see hidden files by default for plugin development.
gsettings set org.gtk.Settings.FileChooser show-hidden true
# Bulding temp vault for testing plugin
mkdir -p ~/vault
cp -R $PWD/.devcontainer/.obsidian ~/vault/.obsidian
mkdir -p ~/vault/.obsidian/plugins
PLUGIN_DIR="$(realpath "$HOME/vault/.obsidian/plugins")"
ln -sf $WORKSPACE "$PLUGIN_DIR/$PLUGIN_NAME"
mkdir -p ~/.config/obsidian
# Make obsidian open the temp vault by default
cp $PWD/.devcontainer/obsidian.json ~/.config/obsidian
echo "PLUGIN_DIR: $PLUGIN_DIR"
echo "PLUGIN_NAME: $PLUGIN_NAME"
echo "WORKSPACE: $WORKSPACE"