I want to be able to launch the “Random note” command directly from my home screen. Currently, the only quick actions are about creating notes or searching.
Proposed solution
Widget that allows setting which command it executes when selected. This would allow any command to be chosen; so new widgets or quick actions wouldn’t need to be created for multiple use cases. The widget could be configured to run the “Random Note” command, or the “New page from template” command, etc.
The widget’s appearance could chose it’s appearance on the home screen based on:
The commands icons (i.e. the icon used when it appears on the mobile toolbar)
Custom configuration when creating the widget
Current workaround (optional)
Currently I use the pull-down gesture in the mobile app for this. Open the app, pull down to get a random page quickly.
Related feature requests (optional)
It seems like this kind of widget could capture these other requests
If you’re on a Mac, you can create a shell script, create a shortcut in the Shortcuts app to run it, and add the shortcut to your desktop as a widget.
It’s not the most elegant solution, but until they implement something like this, you’ve got an option.
Here’s the script I’ve used:
CLI="/Applications/Obsidian.app/Contents/MacOS/obsidian-cli"
VAULT="Your Vault Name"
/usr/bin/open -a Obsidian
# Wait up to 30 seconds for Obsidian's CLI to become ready.
for attempt in {1..120}; do
if "$CLI" "vault=$VAULT" vault info=name >/dev/null 2>&1; then
"$CLI" "vault=$VAULT" random
exit $?
fi
/bin/sleep 0.25
done
echo "Obsidian did not become ready within 30 seconds." >&2
exit 1
It seems that Obsidian has to be fully loaded before the CLI becomes active, so you need to have a sleep loop in the script just in case it takes a while for Obsidian to start. I would suspect that the more plug-ins you have installed the longer it would take.
Use any note, canvas, workspace, or base as your homepage. Alternatively, choose a random file, show the graph view, or display a Daily or Periodic Note.