From c3fec697edb40ff4320e0b0626d44804c0a84660 Mon Sep 17 00:00:00 2001 From: Wil Taylor Date: Wed, 15 Feb 2023 20:34:21 +1000 Subject: [PATCH] added dev container --- .devcontainer/.obsidian/app.json | 1 + .devcontainer/.obsidian/appearance.json | 3 + .../.obsidian/community-plugins.json | 1 + .../.obsidian/core-plugins-migration.json | 29 ++++ .devcontainer/.obsidian/core-plugins.json | 20 +++ .devcontainer/.obsidian/hotkeys.json | 1 + .devcontainer/.obsidian/workspace.json | 143 ++++++++++++++++++ .devcontainer/README.md | 9 ++ .devcontainer/devcontainer.json | 30 ++++ .devcontainer/getObsidian.sh | 15 ++ .devcontainer/menu | 10 ++ .devcontainer/obsidian.json | 1 + .devcontainer/postStart.sh | 25 +++ 13 files changed, 288 insertions(+) create mode 100644 .devcontainer/.obsidian/app.json create mode 100644 .devcontainer/.obsidian/appearance.json create mode 100644 .devcontainer/.obsidian/community-plugins.json create mode 100644 .devcontainer/.obsidian/core-plugins-migration.json create mode 100644 .devcontainer/.obsidian/core-plugins.json create mode 100644 .devcontainer/.obsidian/hotkeys.json create mode 100644 .devcontainer/.obsidian/workspace.json create mode 100644 .devcontainer/README.md create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/getObsidian.sh create mode 100644 .devcontainer/menu create mode 100644 .devcontainer/obsidian.json create mode 100755 .devcontainer/postStart.sh diff --git a/.devcontainer/.obsidian/app.json b/.devcontainer/.obsidian/app.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.devcontainer/.obsidian/app.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.devcontainer/.obsidian/appearance.json b/.devcontainer/.obsidian/appearance.json new file mode 100644 index 0000000..c8c365d --- /dev/null +++ b/.devcontainer/.obsidian/appearance.json @@ -0,0 +1,3 @@ +{ + "accentColor": "" +} \ No newline at end of file diff --git a/.devcontainer/.obsidian/community-plugins.json b/.devcontainer/.obsidian/community-plugins.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/.devcontainer/.obsidian/community-plugins.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/.devcontainer/.obsidian/core-plugins-migration.json b/.devcontainer/.obsidian/core-plugins-migration.json new file mode 100644 index 0000000..3106ebd --- /dev/null +++ b/.devcontainer/.obsidian/core-plugins-migration.json @@ -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 +} \ No newline at end of file diff --git a/.devcontainer/.obsidian/core-plugins.json b/.devcontainer/.obsidian/core-plugins.json new file mode 100644 index 0000000..086a8e4 --- /dev/null +++ b/.devcontainer/.obsidian/core-plugins.json @@ -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" +] \ No newline at end of file diff --git a/.devcontainer/.obsidian/hotkeys.json b/.devcontainer/.obsidian/hotkeys.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.devcontainer/.obsidian/hotkeys.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/.devcontainer/.obsidian/workspace.json b/.devcontainer/.obsidian/workspace.json new file mode 100644 index 0000000..d07e777 --- /dev/null +++ b/.devcontainer/.obsidian/workspace.json @@ -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": [] +} \ No newline at end of file diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..4449d2d --- /dev/null +++ b/.devcontainer/README.md @@ -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. \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..2c89d59 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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"] + } + } +} diff --git a/.devcontainer/getObsidian.sh b/.devcontainer/getObsidian.sh new file mode 100755 index 0000000..9804b00 --- /dev/null +++ b/.devcontainer/getObsidian.sh @@ -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 + diff --git a/.devcontainer/menu b/.devcontainer/menu new file mode 100644 index 0000000..7f93cad --- /dev/null +++ b/.devcontainer/menu @@ -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] \ No newline at end of file diff --git a/.devcontainer/obsidian.json b/.devcontainer/obsidian.json new file mode 100644 index 0000000..6a66b89 --- /dev/null +++ b/.devcontainer/obsidian.json @@ -0,0 +1 @@ +{"vaults":{"95a79339294e3474":{"path":"/home/codespace/vault","ts":1676451456265,"open":true}}} \ No newline at end of file diff --git a/.devcontainer/postStart.sh b/.devcontainer/postStart.sh new file mode 100755 index 0000000..cd0fba9 --- /dev/null +++ b/.devcontainer/postStart.sh @@ -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"