Hi Rainer,
I suspect that BBEdit's Script menu will always be blocking because as far as I know it uses an XPCService. (This should be checked with Bare Bones support though!)
I think of 2 other options that you could try:
Option 1. Use the menubar Script Menu.
• Activate the menubar Script Menu in Script Editor > Preferences > General > Script Menu.
• Create BBEdit's application scripts directory :
% mkdir -p ~/Library/Scripts/Applications/BBEdit • Scripts placed in this directory should appear in the menubar Script Menu when BBEdit is the frontmost application. Generally they act as if they where run from the Script Editor.
• Sometimes this allows you to do things you couldn't do from BBEdit's Script menu (like restarting BBEdit for example).
Option 2. Create a launchAgent that watches the folder containing your quarto files and that executes a script whenever a file is saved and thus refreshes the preview. (Replace '<rainer>' with your user account in the below paths.) • Save this launchAgent in ~/Library/LaunchAgents/quarto_watcher.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>quarto_watcher</string>
<key>ProgramArguments</key>
<array>
<string>/Users/<rainer>/Library/Application Support/BBEdit/Scripts/quarto_previewer.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/<rainer>/Documents/Quarto</string>
</array>
</dict>
</plist>
• Save this script in
~/Library/Application Support/BBEdit/Scripts/quarto_previewer.sh and give it the execution permission.
#!/usr/bin/env sh
DOCPATH=$(osascript -e 'tell application "BBEdit" to (URL of first document) as string')
EXTENSION="${DOCPATH##*.}"
#echo $DOCPATH
#echo $EXTENSION
if [ $EXTENSION == "quarto" ]; then
/usr/bin/open -a quarto "$DOCPATH"
fi
• Create the
/Users/<rainer>/Documents/Quarto directory. (Or some other directory and change the launchAgent accordingly.)
• Start the launchAgent in the terminal with:
% launchctl load /Users/<rainer>/Library/LaunchAgents/quarto_watcher.plist • Now whenever a file with extension ".quarto" is saved in the
~/Documents/Quarto directory, the
quarto_previewer.sh script should execute and open or reload this file in quarto.
HTH
Jean Jourdain