I’ve written two macOS Services (which are now, I guess, called Automator Workflows?) to help me link between folders on my filesystems & relevant URLs and Bear notes. This has been particularly useful as I collect 3D models from Thingiverse; I want to keep a record of where each model came from.
The first is called “Weblink from Clipboard Here”. To use it, I put a URL on the clipboard, most often with the Safari shortcut sequence
⌘L ⌘C. Then, I just right-click a folder in Finder and activate the service. A new file appears, which is a shortcut to the URL:
The service will fetch the page’s title, strip out special characters, and use that value as the filename. This feature requires the tool pup, which handles HTML parsing from the CLI.
The core of the Weblink from Clipboard Here service is a shell script, available in this Gist.
I’ve also written a companion service which accepts a link to a note in Bear: “Bear Link from Clipboard Here”. This performs similarly to the first service, but it uses some AppleScript automation to get the note’s title and use it as the filename. (There’s some clever/slightly-crazy AppleScript-embedded-in-Bash happening to accomplish that.) As a finishing touch, it sets the shortcut file’s icon to the correct icon for a Bear document:
The core of this service is another Bash script, available in this Gist.