Arc browser is mostly link-friendly, but Little Arc window has an AppleScript issue

I’ve had access to Arc for a while but I wasn’t using it much; then I received very positive words about it from my friend Adam Engst (of Tidbits), and have fallen in love with it. Arc is clearly compatible with the CogSci Apps / Hookmark / Cognitive Productivity philosophies. And it is software-compatible with Hookmark except there are cases where the “Little Arc” window doesn’t accept AppleScript.

Here follow (a) the current integration; (b) an alt integration that works with Little Arc window; (c) a request.

current integration

the current integration script for Arc (built into Hookmark) is as follows

tell application "Arc"
	
	set theTitle to title of active tab of front window
	
	
	set theUrl to URL of active tab of front window
	
	return "[" & theTitle & "](" & theUrl & ")"
end tell

work around for Little Arc window

our work around which is UI scripted works for both cases, but we are not fans of UI scripting, so I hesitate to make it the default. We’ll see.

use AppleScript version "2.5"
use framework "Foundation"
use scripting additions


set langStr to ""
try
	set resultText to (do shell script "defaults read company.thebrowser.Browser AppleLanguages")
	set langIDs to {}
	set {TID, text item delimiters} to {text item delimiters, quote}
	set resultItems to text items of resultText
	text item 1 of resultText
	set text item delimiters to TID
	repeat with i from 1 to (count resultItems)
		if i mod 2 = 0 then set end of langIDs to resultItems's item i
	end repeat
	set langStr to first item of langIDs
	
end try


if langStr is missing value or langStr is "" then
	set langStr to first item of (current application's NSLocale's preferredLanguages as list)
end if
set langID to text 1 thru -4 of langStr
set copyLink to "Copy URL as Markdown"
set editMenu to "Edit"

delay 0.1
set the clipboard to ""
delay 0.1


try
	tell application "System Events" to tell process "Arc"
		click menu item copyLink of menu 1 of menu bar item editMenu of menu bar 1
		delay 0.05
		repeat 50 times -- poll clipboard for ~2.5 seconds
			try
				set theUrl to the clipboard
				if theUrl is not equal to "" then
					exit repeat
				end if
			end try
			delay 0.05
		end repeat
		return theUrl
		
	end tell
	
on error msg
	display dialog msg
end try

however, you can use the above. Please let us know what you think of that integration.

Arc developers

If you use Arc, please upvote my request for them to support AppleScript in Little Arc windows too.

Here is more info:

Using Hookmark with Arc: Rhymes for a reason :wink:

I invite you to share your workflows of Arc with Hookmark in new topics on this forum, or below. I will do some blogging about the topic later, given that it has become my default web browser, and the aforementioned compatibility.

By the way: thank you all for contributing to this community, and to the objectives of the Manifesto for Ubiquitous Linking !

a tweet

2 Likes

Do pinned favorites work the same way? I’ve noticed that Hookmark never correctly captures page titles when used on a pinned web app (I tested it with Reader by Readwise and Notion). But it works perfectly if I open the same page in an unpinned tab.

I think pinned are fine in my tests.

No clue what the actual problem was, but using your Little Arc integration script fixed it for me! My guess was that some preview feature only available in pinned and favorites like Peek was the culprit, which is why I gave it a shot since LA is sort of a pop-up preview.

1 Like

Hmm. So my Arc folder structure mimics my file directory structure. So for example I might have:

/Teaching/Spring/Algorithms

in both Arc and Finder, and also in Obsidian. Typically my workflow is to either:

  • open up a folder in VS Code using Alfred
  • open Obsidian and go to a folder by search [typically a “project folder” in Finder <=> a “project roadmap note” in Obsidian]
  • open Arc and go to the folder by navigating to it manually

So what I was really hoping hookmark can do for me is to eliminate the manual part of the last step, especially if I am trying to get to an Arc tab or folder from when I am in either Code or Obsidian.

I think the issue is that Arc does not seem to expose folders or subfolders as actual locations that Hook can latch on to:

and as for tabs, when Hook records an Arc tab, it perhaps interprets it as a URL divorced from its location in the folder hierarchy? So when I click on an Arc tab via Hook starting from Finder, for example, a Little Arc window opens up, which is not what I want.

I guess this should be doable because the Raycast and Alfred extensions for Arc in fact do locate the tabs in the folder structure. Not sure what I am missing with Hook.

The other way is fine: if I start out in Arc, I’ve dumped dummy index.html files in all folders so that I can use Hook to get out of Arc into Obsidian, Code, and Finder.

For now, I am giving these dummy index.html files titles that match the parent folder’s name so I can search for them through Alfred or Raycast and land in the right folder through a dummy root file that’s sitting in the folder.

that does seem to be the case. Hookmark acts on the currently selected or open. Folders can’t be selected in a persistent way. The AppleScript doesn’t seem to expose that either. And I don’t see a method in the UI to grab a handle onto the folder. I’ve emailed The Browser Company.

if you or someone could point us at their integration we could get a better handle of the interactions Arc affords. I’ve started using Arc but am not a deep user yet.

Adam Engst published: Arc Will Change the Way You Work on the Web - TidBITS. He writes:

And context is powerful! Like many people, I’m easily distracted, so anything that takes me away from the topic and document I’m working on, even briefly (Squirrel), derails me, requiring extra effort to get back on track. Tools and techniques that reduce distraction or help me resume where I left off more quickly have outsized value.

I can see that Arc can help with context. Hookmark of course is all about Context. We did lead the Manifesto for Ubiquitous Linking which is about contextual computing. If Adam’s article on Arc resonates with Tidbits readers on the basis of contextual computing, one would think they’d like to learn about Hookmark :blush: .

Maybe when Hookmark is invoked on the current web page , Hookmark could get a handle on the folder. I don’t see any folder object in the AppleScript dictionary. I do see tab objects. A URL can presumably be in multiple folders – maybe that’s why they don’t expose it.

We’ll have a closer look at their dictionary and hopefully The Browser Company will respond. A little communication with them on Twitter might help.

(A quick response for now; will have more later…)

Here’s the Raycast extension and here is an Alfred workflow.

They seem to allow me to search the tab space, and when I click on a search result it takes me to the tab in the folder they are located in, which is the aspect I am unable to recreate with Hookmark.

Hope this is useful!

2 Likes

I have been experimenting with Arc and came across the same issue of linkable URLs in LittleArc.
Your additional script seems to work for me, in that Hookmark will function within a LittleArc window.

There still seems to be an issue with “peek” windows.
For examle,access this URL
https://discourse.hookproductivity.com/
by clicking Forum from the main page
https://hookproductivity.com/
Arc’s “natural”/default behavior is to pop up a peek window,not a LittleArc window. In this case, Hookmark will be unable to find anything linkable.

To check, this action can be overriden by the context menu when clicking on the “Forum” link with the “OpenLink In Little Arc” option.Hookmark can find linkable items in this LittleArc window.See attached screenshots.


2 Likes

FYI…
A lot of the internal Arc database can be viewed by following the link traversal here.
Help->Troubleshooting->Reveal Arc Data.
Buried in there is a set of JSON objects… one of which is StorableSidebar.json.
This appears to fully capture the folder/tab hierarchy of the sidebar.
This is outside the area of my expertise, but I imagine the Raycast extension uses this to identify the tabs and just invokes Arc with the selected URL.

2 Likes