if [[ {{file_extension:no-dot}} == "pdf" ]]; then
var={{file_path:absolute}}
open "obsidian://advanced-uri?vault=Ext%20Brain&commandid=app%253Ago-back" #got this from advanced uri command "Copy URI for command" selected "No File" then "Navigate Back"
open "obsidian://advanced-uri?vault=Ext%20Brain&eval=if%28app.workspace.getActiveFile%28%29.extension%3D%3D'pdf'%29%7Bapp.workspace.activeLeaf.tabHeaderCloseEl.click%28%29%7D"
open $var
fi
Updated it so it’ll close the pdf if there’s no note to navigate back to. Note you’ll have to enable “Allow executing arbitrary code via eval” in Advanced URI plugin settings.