obsidian-map-view icon indicating copy to clipboard operation
obsidian-map-view copied to clipboard

Inline geolink ctrl+click can trigger an action within Obsidian and an external browser at the same time

Open ybnd opened this issue 10 months ago • 1 comments

Problem

I've got ctrl+click on an inline geolink configured to focus it in a map in another pane.

At some point, this action started trying to open Google Maps in my default browser at the same time. Unlike the plugin's "open in Google Maps" context menu action, the link is not interpreted correctly and just shows my current location.

This only seems to happen with ctrl+click, not regular clicks or middle clicks.

Workaround

Map View links are valid as per the geo: URI scheme, so the links not opening correctly could just be an issue with my system.

I was able to disable the geolinks opening my browser by setting the default handler to a dummy application that does nothing: gio mime x-scheme-handler/geo dummy.desktop.

OS/environment

Debian 12 + GNOME 43.9

ybnd avatar Feb 22 '25 14:02 ybnd

Map View makes a (pretty hacky) effort to kidnap geolinks from the editor, in a way that doesn't have a formal API, to open them internally rather than with the system's default handler. There is no specific handling for Ctrl+click vs click, and since I can't recreate it, understanding where it goes wrong in your case is difficult. If you are able to, it would be helpful if you could debug what happens when you Ctrl+Click in the handlers set in geoLinkReplacers.makeDecoration. In theory handlePointerUp and handlePointerDown are supposed to shut off the default functionality you are seeing, and for some reason it fails with Ctrl+click.

esm7 avatar Feb 27 '25 14:02 esm7