This is an Obsidian plugin that allows you to easily run script written in any language directly from the app
Go to the most recent tag and download the script-launcher zip, unzip it and extract the script-launcher folder (it should contain 3 files: main.js manifest.json and styles.css)
Move this folder into path_to_your_vault/.obsidian/plugins/
(if the plugins folder is not already there create it)
Remember to enable Commpunity Plugins in the Obsidian settings
Go in the plugin settings and click the +
icon
You will have to fill in some information about the script you want to add:
Script name
→ the name of the script you want to add (has no influnence on the script itself)Script path
→ absolute path to the script you want to launch (it can be anything: binary, executable, python script,shell script, bash script ecc...)Show on bottom bar
→ this is a checkbox, if selected the script will be shoen on the bottom bar and clicking it will launch itIcon
→ is the icon discplayed on the bottom bar, if left empty the name will be shown instead
Click the Delete
button on the script's settings you want to delete
Click the scipt icon on the bottom bar of the Obsidian app.
If the script does not show up as an icon go in the settings and select Show on bottom bar
You can also run the script using the Run script
Obsidian command, you will be prompted with a list of scripts with a searchbar, selecting a script will run it.
The output of the script will be shown as notices in the Obsidian app
This script for example syncs on demand files from all you vaults at the click of a button
(cd $path_to_vaults && grive -s $vaults_folder)
if you want to write a script to backup only the files in your vault you can use the $1
argument:
The plugin passes the path to your vault as the first parameter to the script
(cd $path_to_script && grive -s $1)
The second parameter passed to the script ($2
) is the path to the currently open file, if there is no open file an empty string will be returned (""
)
The scripts informations are saved in the data.json
file under the .obsidian/plugins
folder
This is how it looks normally:
[
{
"name": "Example",
"path": "/home/user/Documents/obsi/s.sh",
"showOnBottomBar": true,
"icon": "☁",
}
]
But you can manually add some options that are not shown in the user interface if needed: