trying to think how to get this done as well
I don’t think Logseq has an API for this, but perhaps they would be amenable to providing it:
Thank you for your reply, I will try to contact the developer of Logseq, maybe they will support an API for this in the future.
just checking if there is any update on this
Hi, I have contacted with the developer of Logseq, they will add support for Hook, maybe we will see the integration of hook and Logseq later.
Thank you for work, they say Hook has contacted with them on Twitter, but do not know how to achieve it, now they start do some work with it.
Thank you for letting us know! I checked last night build and it seems the feature is not there yet. We will work on the integration with Logseq once this feature is available.
I also wonder if this feature will ever come to logseq
There’s a Twitter thread on the subject if you’d like to join the discussion there. I wrote:
A logseq rep asked on Twitter
what can we do to help you become an even better coder?
I answered
Make your app linkable. That’s what leading Mac developers have done: Manifesto for Ubiquitous Linking
cf. Information for Developers to Make Their Apps Linkable (API Requirements for Compatibility with Hook) – Hook
The rep seemed to think that linkability just entails having a UI for linking, as he wrote:
I replied that
the manifesto calls for automation to obtain the link and title of the resource https://linkingmanifesto.org/technical-requirements/…. Any form of automation will do. The manifesto is agnostic about the API language.
Please feel free to chime in there.
FYI
I just wrote this, if there is any misunderstanding, please help explain.
If anyone sees this message, please click on the link above and click vote in the upper left corner, this will help Logseq pay more attention to this feature request.
Welcome to the Hookmark Forum, @hexinzhe, and thank you for this. That helps. I have added a comment there.
it is sometimes useful to reference the Manifesto for Ubiquitous Linking for devs and their community to appreciate the full context. I’ll mention that next.
I am not a good applescript programmer, but I wrote this to make hookmark work with logseq.
You must replace MYGRAPHNAME with the name of your logseq graph (which you can see when you copy a block URL). You must also add :editor/copy-embed "mod+shift+c"
to :shortcuts
in config.edn. If there is a keyboard shortcut for copying block URL this would not be necessary, but there isn’t, so I have to change the block reference to a URL myself.
set savedClipboard to the clipboard
set the clipboard to ""
tell application "Logseq" to activate
tell application "System Events"
keystroke "c" using {command down, shift down}
delay 0.05
repeat 10 times
try
set blockRef to the clipboard
if blockRef is not equal to "" then
exit repeat
end if
keystroke "c" using {shift down, command down}
end try
delay 0.05
end repeat
set blockUrl to "logseq://graph/MYGRAPHNAME?block-id=" & characters 11 thru -5 of blockRef as string
keystroke "a" using {command down}
delay 0.05
keystroke "c" using {command down}
delay 0.05
set blockContents to the clipboard
set blockLength to (get length of (blockContents as text))
if blockLength is less than 32 then
set linkTitle to blockContents as string
else
set linkTitle to (characters 1 thru 32 of blockContents as string) & "..."
end if
end tell
set the clipboard to savedClipboard
return "[" & linkTitle & "](" & blockUrl & ")"
Awesome! thanks for sharing. We’ll have a look. We want to support logseq ASAP.
I tried to paste this into the script gallery in Hookmark for Logseq under the Get Adress, but I couldn’t get it to work. How do you use this script?
Welcome to the Hookmark Forum , @Kullenej . We will publish a tweak with additional instructions very soon. Meanwhile, we urge anyone who wants Logseq automation to contact the Logseq devs to ask them to spend a few minutes to add an API for linking, otherwise their software is in a walled-garden. Or some may wish to contribute directly if you’re a dev and user of that software. Cf Manifesto for Ubiquitous Linking. Obsidian has extensive automation for linking: https://hookproductivity.com/help/integration/using-hook-with-obsidian/ .
The script our user provided. I did a small change by creating a variable for graph name.
#change YourGraphName to your graph's name
set graphName to "YourGraphName"
set savedClipboard to the clipboard
delay 0.05
set the clipboard to ""
delay 0.05
tell application "Logseq" to activate
tell application "System Events"
keystroke "c" using {command down, shift down}
delay 0.05
repeat 10 times
try
set blockRef to the clipboard
if blockRef is not equal to "" then
exit repeat
end if
keystroke "c" using {shift down, command down}
end try
delay 0.05
end repeat
set blockUrl to "logseq://graph/" & graphName & "?block-id=" & characters 11 thru -5 of blockRef as string
keystroke "a" using {command down}
delay 0.05
keystroke "c" using {command down}
delay 0.05
set blockContents to the clipboard
delay 0.05
set blockLength to (get length of (blockContents as text))
if blockLength is less than 32 then
set linkTitle to blockContents as string
else
set linkTitle to (characters 1 thru 32 of blockContents as string) & "..."
end if
end tell
set the clipboard to savedClipboard
return "[" & linkTitle & "](" & blockUrl & ")"
In order to make this script work, In Logseq settings > Edit Config.edn, add the following line:
:editor/copy-embed “mod+shift+c”
to
:shortcuts {
}
After edit, it should look like this:
:shortcuts {
:editor/copy-embed “mod+shift+c”
}
Please let us know your experience with it.
Thank you! I’m actively engaging the Logseq forum for this as well.
But unfortunately, I can’t get the script to work.
Here is how it looks in Hookmark:
I have also restarted both apps, but no luck!
Thanks!!