A wrapper for Arc Browser's basic AppleScript APIs.
It partially implements Arc's AppleScript dictionary and exports functions for interacting with Arc from Node.js runtime. Might be helpful for writing small automations (e.g. using ScriptKit).
Requires Node.js 16+.
npm install @kkoscielniak/arc-applescript-api
import { openTab } from "@kkoscielniak/arc-applescript-api";
await openTab("https://koscielniak.pro");
Represents an Arc's Space.
Property | Type | Description |
---|---|---|
id |
string | A unique identifier for the Space. |
title |
string | The title of the Space. |
index |
number | The index of the Space (1-indexed). |
Represents an Arc's Tab.
Property | Type | Description |
---|---|---|
title |
string | The title of the tab. |
id |
string | A unique identifier of the tab. |
url |
string | The URL of the tab. |
isLoading |
boolean | A flag indicating whether the tab is still loading. |
location |
"pinned"|"unpinned"|"topApp" | The location of the tab |
spaceId |
string | The ID of the Space to which the tab belongs. |
Returns a Promise that resolves to an array of Space
s.
Returns a Promise that resolves to the Space
identified by given spaceId
.
Property | Type | Description |
---|---|---|
spaceId |
string | The ID of the Space to retrieve. |
Returns a Promise that resolves to an array of Tab
s.
Opens a new Tab in the Space currently selected in the front window.
Returns a Promise that resolves to the ID of the newly opened tab.
Property | Type | Description |
---|---|---|
url |
string | The URL to open in a new tab. |
Opens new Tab in the chosen Space.
Returns a Promise that resolves to the ID of the newly opened tab.
Property | Type | Description |
---|---|---|
url |
string | The URL to open in a new tab. |
spaceId |
string | The ID of the Space in which to open the tab. |
Closes a Tab identified by the given tabId
.
Property | Type | Description |
---|---|---|
tabId |
string | The ID of the tab to close. |
Executes JavaScript code in the context of the current tab.
Returns the result of the JavaScript call
Property | Type | Description |
---|---|---|
code |
string | Stringified JavaScript code |
Example:
const result = await executeJs(`
var video = document.querySelector("video");
if (!video.paused){
video.pause();
}
return 'ok';
`);
console.log(result);
This project is a side effect of my experiments with automating the Arc Browser. Its feature-set is limited as of now. I am gradually adding the features whenever I need them.
If there's a missing feature, a bug, or other improvement you'd like, I encourage you to contribute. Feel free to open an issue or, even better, a Pull Request.
This project is not affiliated with Arc Browser or The Browser Company in any way. Consider it a love letter to the Arc's community.
arc-applescript-api
itself is available under DBAD license.