OpenPLUTO

"Open in Default Browser" – A Keyboard Shortcut for Obsidian

Claude Code has helped me create a quality-of-life improvement for Obsidian that I thought others might make use of, so I am here to share that with you today.

It's true: There are 48 active plugins installed in my Obsidian vault. Alarming to some, completely unacceptable to others. None of these plugins however are "vault-breaking" and what I mean by that is none of these plugins do anything to the Markdown files to the point that they become unrecognizable outside of Obsidian. They are still human readable outside the normal Markdown syntax that we are all accustomed to seeing.

When Obsidian released a core plugin that essentially baked a basic web browser into the app, it was a welcome addition. Over the years there have been a couple different attempts at baking a web browser into the app, Surfing is probably the best attempt. I didn't think I would get much use out of the web-viewer, but before you knew it, it was the default way of how I now go about getting text from inside Obsidian to BearBlog.

For this reason, I have the "Open external links" option ticked to on in the Web viewer settings. Every now and again, I'll open a link but would prefer to engage with the website inside my default browser. There is a menu option in the hamburger menu "Open in default browser" which is straightforward enough, but that also requires you to use the mouse. For the Keyboard Cowboys out there, that is too much work. I've been waiting and waiting for a keyboard shortcut to show up with each update, but alas, nothing has come down the line.

Coding scripts to add functionality to Obsidian is pretty far from my area of expertise to say the least. So I thought I'd give this Claude Code thing a crack that everyone is talking about and see what it would be able to come up with.

Suffice it to say I was shown pretty clearly what all this hype is about. After simple instructions on things to look for in the Developer Tools, Claude quickly provided me with a simple script that I invoke with QuickAdd that allows me to add a keyboard shortcut to "Open in default browser". It's just a simple keyboard shortcut, but the amount of joy it brings to my daily life is off the charts. 🤓

To get this magic setup for yourself all you need to do is the following:

For QuickAdd Script

module.exports = async () => {
    const { shell } = require('electron');
    const view = app.workspace.activeLeaf.view;
    if (view.url) shell.openExternal(view.url);
};

For me this amounts to a simple Alt+L to pop sites in my default browser. A simple tweak, sure, but one that eliminates a lot of friction. ■

#obsidian