External links are not working
opening the external link to a note doesn't open the note in Joplin.
Environment
Joplin version: 2.8.8 (AppImage) Platform: Linux OS specifics: openSuse tumbleweed
Steps to reproduce
- copy the external link to a note. The link is like
joplin://x-callback-url/openNote?id=xxxxxxxxxxxxxxxxxxxxxxx - switch to a different note or close Joplin
- open that link via a browser (in my case, Firefox)
- Joplin pops up without opening the target note
Describe what you expected to happen
Joplin should have opened the target note
Logfile
No messages or warnings show up when the external link is clicked.
I can't replicate this on my system (Linux Mint), the behaviour you are saying is known to be present on macOS but not seen it on Linux before.
If you open the dev tools (Help > Toggle Development tools) then replicate it (just swap notes, don't close Joplin) does it print an error or anything to the console?
Sorry, I wasn't clear. It does not print anything to the console.
I didn't do anything strange with my Joplin setup, though I didn't use the download script. I downloaded the app image file and created a .desktop file:
[Desktop Entry]
Encoding=UTF-8
Name=Joplin
Comment=Joplin for Desktop
Exec=/home/capfredf/Applications/Joplin.AppImage
Icon=joplin
StartupWMClass=Joplin
Type=Application
Categories=Office;
MimeType=x-scheme-handler/joplin;
X-GNOME-SingleWindow=true // should be removed eventually as it was upstream to be an XDG specification
SingleMainWindow=true
Is there a way to check if an Joplin instance sees the whole callback url?
Is there a way to check if an Joplin instance sees the whole callback url?
If you open dev tools and try to open a callback url, joplin should print in the log:
openUrl joplin://x-callback-url/openNote?id=c8b3f7b57ea5415292b3338eb0a14c2c
@roman-r-m I don't see any debug message printed. I will post a screenshot later
Since you're saying that Joplin does pop up when you click on a link, it seems the handler is set up correctly, but just to be sure can you run this command:
xdg-mime query default x-scheme-handler/joplin
here is the result:
➤ xdg-mime query default x-scheme-handler/joplin
appimagekit-joplin.desktop
Here is the logs I gathered.
10:41:54: ShareService: Refresh share invitations:
Logger.ts:219 10:41:54: ShareService: Refreshed shares: {items: Array(0), has_more: false}
Logger.ts:219 10:41:54: Synchronizer: Sync: finished: Synchronisation finished [1663684889660]
Logger.ts:219 10:41:54: Synchronizer: Operations completed:
Logger.ts:219 10:41:54: Synchronizer: createRemote: 1
Logger.ts:219 10:41:54: Synchronizer: Total folders: 7
Logger.ts:219 10:41:54: Synchronizer: Total notes: 23
Logger.ts:219 10:41:54: Synchronizer: Total resources: 8
useMessageHandler.ts:16 Got ipc-message: noteRenderComplete undefined
Note that the last warning comes from switching notes. No messages were printed when I clinked on an external link.
Is there a joplin command to open a url? something like joplin-desktop --open-url <url>?
Is there a
joplincommand to open a url? something likejoplin-desktop --open-url <url>?
There is - that's pretty much how it works currently. The URL is passed as a param to Joplin. I've just tried running something like
./Joplin-2.8.8_8545da5e9d4bfe910cf9ff03e81ba7a7.AppImage "joplin://x-callback-url/openNote?id=5cab329530334118a58130b9c2e7e3fb"
and it opened Joplin and switched to the right note. Can you try it too?
You may need to change this in your .desktop file:
Exec=/home/capfredf/Applications/Joplin.AppImage %U
Thanks @roman-r-m
./Joplin-2.8.8_8545da5e9d4bfe910cf9ff03e81ba7a7.AppImage "joplin://x-callback-url/openNote?id=5cab329530334118a58130b9c2e7e3fb"
This command indeed opens the corresponding note.
Is xdg-open supposed to work with a joplin URL? e.g. xdg-open "joplin://x-callback-url/openNote?id=5cab329530334118a58130b9c2e7e3fb".
On my machine, it brings the Joplin to the front but it doesn't make Joplin open the right note.
Regardless, both commands produce a warning:
➤ ~/Applications/Joplin.AppImage 'joplin://x-callback-url/openNote?id=d53adbff3e95494291d3fc70c76a099b'
xdg-settings: invalid application name
Try 'xdg-settings --help' for more information.
➤ xdg-open 'joplin://x-callback-url/openNote?id=cfcb6f6cb58f42fca07ce622ec1e053e'
➤ xdg-settings: invalid application name
Try 'xdg-settings --help' for more information.
Based on https://discourse.joplinapp.org/t/problem-in-running-application-xdg-settings-invalid-application-name/23798/4, it seems like a red herring though.
Exec=/home/capfredf/Applications/Joplin.AppImage %U
for some reason, I missed this piece. By adding the trailing %u, now my Joplin can open a note via a callback URL.
FWIW, setting the Joplin url handler to ~/Application/Joplin.AppImage in Firefox also helps partially work around my mistake.
Thanks @roman-r-m