Small question: external links to DT (x-devonthink-item://) open in DT in a new window, instead of the main one. Is there a way to change this behavior, so links will open in the main window?
You could append ?reveal=1 to the links to reveal the item in the main window.
I could’ve sworn that the default behavior was to open in the main window (which is preferable for me), but recently noticed that it doesn’t. Has it always been this way?
Reveal was added. Many Users like to open the files in their own windows, especially because they can open in the current space.
I’d vote to have this be an option instead of the default. I very often use “Copy Item Link” to add DT items to my to do list (Things). It’s a little clumsy that these links always open a new window in DT, requiring me to use the “reveal” button, then close the new window.
One solution would be an AppleScript that would put the item URL in the clipboard with “?reveal=1” appended.
Does anyone know the AppleScript to get the x-devonthink-item:// URL of a selected item?
tell application id "DNtp" to get the reference URL of (item 1 of (selection as list))
Thanks. I modified one of the default AppleScripts to copy the item link of the selected item + “?reveal=1” to the clipboard. I added it as a toolbar script for easy access.
tell application id "DNtp"
if not (exists think window 1) then error "No window is open."
if not (exists content record) then error "Please open a document."
set itemURL to get the reference URL of (item 1 of (selection as list)) & "?reveal=1"
set the clipboard to itemURL
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
Well done. It’s always nice to roll your own solutions and take control of your computer.
@cgrunenberg Are there any parameters that one can add to the link to reveal the item in a NEW window (irrespective of whether there is another viewer window open, etc.)? Thanks!
No, there are currently no such parameters.
Thanks for getting back to me @cgrunenberg
Is there any way we could get that feature in a future DT update?
For example, in one app that I have, they follow a similar URL scheme but use 0/1 to distinguish whether you’d like to trigger things in a new window or an existing one (e.g., ?reveal=1 vs. ?reveal=0). That might work well with your scheme, too?
Thanks for your consideration!
No promises as it’s the first request of its kind but noted.
This would be a really helpful feature if it could be added
The way I’d love to see this feature work is:
- URL?reveal=1 opens in main window
- URL?reveal=0 opens in new window
- Add a preference option to define which behavior is used when “reveal” isn’t specified in the link
This depends currently on the preferences - if tabs are enabled, then documents might be opened in the main window if the preview pane is visible. Without a main window or without a preview pane a new document window is opened.
I would say that this little detail is very important and I am very glad that it was considered.
Thank you for mentioning them here @cgrunenberg
I expected the page links that I copied open in new window. However I saw that they opened in the main window.
I thought that totally makes sense. If you are concentrating on reading one PDF than close the main window and all the page links to that document is going to open in the PDF viewer (new window).
Otherwise, if you are just opening random references to random documents than it is more useful to be able to open them in the main window, as you have all the actions there.
If you additionally want to use RTF links to reveal records take a look at Script: Modify x-devonthink item links to reveal records
Ideally, if “tabs are enabled” (and, possibly, the Always show tab bar option is ticked – if you feel this provides better backwards compatibility for the user experience), the
URL?reveal=1 link should open the referred document in a new tab. Alternatively, you may want to consider a
reveal=2 option for specifying that the referred document should be opened in a new tab in the main/existing window.
Whilst opening in a new tab can be achieved from within DT using Cmd+Click (or via the context menu), there is no mechanism to engage this behaviour from outside DT (e.g. if using
x-devonthink-item:// links in third-party documents).
As a final comment, the current behaviour of activating a tab that is already showing the referred document is excellent and should (obviously) be retained. However, there is currently a defect associated with this implementation: the currently active tab is cleared. Other tabs are preserved correctly; only the active tab is cleared when activating the tab that contains the document corresponding to the
A screenshot would be useful.