A hack to speed up command line usage

I’m not quite sure where to post this, but I thought it’d be useful to share somewhere in case someone else is looking for a solution.

I absolutely love Obsidian’s relatively-new command-line support (though I’d love it more if it gained line-in-file support). However, it was somewhat cumbersome to use on my Linux system because opening a file via the command line (using the syntax of obsidian obsidian:///{file_name}) was seemingly slow to respond. How slow? Around 800ms, which may not sound like much, but when trying to quickly jump to a note using a script it’s a very noticeable lag.
So I investigated a bit, and I noticed that when I launch the obsidian binary directly from the mounted AppImage directory (e.g. /tmp/.mount_obsidi28jna9), the response was significantly faster (on my system around 250ms).

This was a worthy improvement to pursuit, but I couldn’t find an easy way to query for where an AppImage is currently mounted (though I’m sure there is one). So I made a dirty patch that my Python scripts now use, to guess where Obsidian is mounted and then launch it from there:

# There must be a prettier way to do this
obsidian_paths = glob.glob('/tmp/.mount_obsidi*')
if len(obsidian_paths) == 0:
    print("Can't find where Obsidian is mounted")
    sys.exit(1)

editor_path = os.path.join(obsidian_paths[0], 'obsidian')

So here it is, my ugly patch that saves me a few precious seconds every day :wink:

4 Likes