Skip to content

armgit / cra

Public Imported from GitHub
0

The open-source Arc replacement for macOS. Spaces, pinned tabs, split view, Little Windows and Arc's shortcuts on Chromium, with your Arc sidebar imported in one go.

Arc parity: View ▸ Cast… and Help ▸ Troubleshooting ▸ Open Task Manager

Victord7298956b1f1
diff --git a/Sources/Cra/App/AppDelegate.swift b/Sources/Cra/App/AppDelegate.swift
index cb191d4..ebb43db 100644
--- a/Sources/Cra/App/AppDelegate.swift
+++ b/Sources/Cra/App/AppDelegate.swift
@@ -1295,6 +1295,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
case "expandAllFolders": store.setAllFoldersExpanded(true, inSpace: main.focusedSpaceID)
case "openExtensions": main.showSiteControlsFromTheirButton()
case "manageExtensions": main.openExtensionsPage()
+ case "cast": if main.currentBrowser?.runChromeCommand("IDC_ROUTE_MEDIA") != true { main.showToast("Nothing to Cast") }
+ case "taskManager": if main.currentBrowser?.runChromeCommand("IDC_TASK_MANAGER") != true { main.showToast("Open a Page First") }
case "showArchive": main.showLibrary(.archive)
case "clearArchive": store.clearArchive()
case "stayOnTop": main.toggleStayOnTop()
@@ -1545,7 +1547,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
view.addItem(.separator())
view.addItem(item("resetZoom")); view.addItem(item("zoomIn")); view.addItem(item("zoomOut"))
view.addItem(.separator())
- view.addItem(item("pictureInPicture"))
+ view.addItem(item("pictureInPicture")); view.addItem(item("cast"))
view.addItem(.separator())
for id in ["addSplitView", "closeSplitPane", "separateFromSplit", "flipSplitOrientation"] { view.addItem(item(id)) }
view.addItem(.separator())
@@ -1614,7 +1616,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
let trouble = NSMenu(title: "Troubleshooting")
trouble.addItem(withTitle: "Export Diagnostics…", action: #selector(exportDiagnostics), keyEquivalent: "").target = self
trouble.addItem(.separator())
- trouble.addItem(item("revealData")); trouble.addItem(item("copyAppInfo"))
+ trouble.addItem(item("taskManager")); trouble.addItem(item("revealData")); trouble.addItem(item("copyAppInfo"))
help.addItem(submenu: trouble, title: "Troubleshooting")
menubar.addItem(submenu: help, title: "Help")
NSApp.helpMenu = help
diff --git a/Sources/Cra/App/KeyBindings.swift b/Sources/Cra/App/KeyBindings.swift
index 137880e..50780be 100644
--- a/Sources/Cra/App/KeyBindings.swift
+++ b/Sources/Cra/App/KeyBindings.swift
@@ -180,6 +180,9 @@ final class KeyBindingRegistry {
KeyAction(id: "inspectElement", name: "Inspect Elements", section: .view, shortcuts: [Shortcut("c", cmdOpt)], inCommandBar: false),
KeyAction(id: "jsConsole", name: "JavaScript Console", section: .view, shortcuts: [Shortcut("j", cmdOpt)], inCommandBar: false),
// Arc: Extensions ▸ Picture in Picture (no shortcut); "Open Picture in Picture" in the command bar.
+ // Arc: View ▸ Cast; Help ▸ Troubleshooting ▸ Open Task Manager. Chrome's own.
+ KeyAction(id: "cast", name: "Cast…", section: .view, shortcuts: [], triggers: ["cast", "chromecast", "airplay"]),
+ KeyAction(id: "taskManager", name: "Open Task Manager", section: .help, shortcuts: [], triggers: ["task manager", "memory", "processes"]),
KeyAction(id: "pictureInPicture", name: "Picture in Picture", section: .view, shortcuts: [], triggers: ["pip", "picture in picture", "pop out", "popout", "video"]),
// Arc: View ▸ Add Split View ⌃⇧=, Close this Split Pane ⌃⇧-, Separate Page from Split View, Expand Current Split.
KeyAction(id: "addSplitView", name: "Add Split View", section: .view, shortcuts: [Shortcut("=", [.control, .shift])], triggers: ["split", "split view", "add split"]),
diff --git a/Sources/CraCEF/CraCEF.mm b/Sources/CraCEF/CraCEF.mm
index ba5ae67..4041f59 100644
--- a/Sources/CraCEF/CraCEF.mm
+++ b/Sources/CraCEF/CraCEF.mm
@@ -17,6 +17,7 @@
#include "include/cef_browser.h"
#include "include/cef_client.h"
#include "include/cef_command_ids.h"
+#include "include/cef_id_mappers.h"
#include "include/cef_command_line.h"
#include "include/cef_context_menu_handler.h"
#include "include/cef_display_handler.h"
@@ -2521,6 +2522,13 @@ static NSView* FindRenderWidgetHostView(NSView* root) {
}
- (void)print { if (_browser) _browser->GetHost()->Print(); }
- (void)viewSource { if (_browser) _browser->GetMainFrame()->ViewSource(); }
+- (BOOL)runChromeCommand:(NSString*)name {
+ if (!_browser) return NO;
+ int command = cef_id_for_command_id_name(name.UTF8String);
+ if (command <= 0 || !_browser->GetHost()->CanExecuteChromeCommand(command)) return NO;
+ _browser->GetHost()->ExecuteChromeCommand(command, CEF_WOD_CURRENT_TAB);
+ return YES;
+}
- (void)executeJavaScript:(NSString*)script {
if (_browser) _browser->GetMainFrame()->ExecuteJavaScript(CefStringFromNS(script), _browser->GetMainFrame()->GetURL(), 0);
}
diff --git a/Sources/CraCEF/include/CraCEF.h b/Sources/CraCEF/include/CraCEF.h
index 2cd20d5..ad16d19 100644
--- a/Sources/CraCEF/include/CraCEF.h
+++ b/Sources/CraCEF/include/CraCEF.h
@@ -219,6 +219,9 @@ typedef NS_ENUM(NSInteger, CraLinkWindow) {
- (void)skipPictureInPictureBy:(double)seconds NS_SWIFT_NAME(skipPictureInPicture(by:));
- (void)print;
- (void)viewSource;
+/// One of Chrome's own commands by its IDC name ("IDC_ROUTE_MEDIA" for Cast…, "IDC_TASK_MANAGER"),
+/// where Chromium can run it for this page. NO when it can't.
+- (BOOL)runChromeCommand:(NSString *)name NS_SWIFT_NAME(runChromeCommand(_:));
- (void)executeJavaScript:(NSString *)script;
/// Asks the page for its background colour again (-browser:didReportBackgroundColor:);
/// pages can switch themes without a load.
diff --git a/docs/arc-parity.md b/docs/arc-parity.md
index d03eeca..eed0f65 100644
--- a/docs/arc-parity.md
+++ b/docs/arc-parity.md
@@ -26,7 +26,7 @@ or Arc-only service), per CONTRIBUTING.md.
| Copy URL without trackers | Copy URL ⇧⌘C ("Copy the current tab's URL without trackers") | done | utm_* and click ids dropped (CleanURL). |
| Copy URL as Quote | Edit ▸ ⌃⇧⌘C, "Enable Shared Quotes when highlighting text" | done | Arc links to arc.net (cloud); Cra copies a text-fragment link. |
| AppleScript dictionary | Arc.sdef, View ▸ Developer ▸ Allow JavaScript from Apple Events | missing | Raycast and other launchers script Arc through it. |
-| Cast | View ▸ Cast | missing | Chromium's media router. |
+| Cast | View ▸ Cast | done | Chrome's Cast bubble (IDC_ROUTE_MEDIA). |
| Find and Replace, Use Selection to Find, Jump to Selection | Edit ▸ Find | missing | |
| Sound effects | Settings ▸ Advanced "Play Arc sound effects" | done | Settings ▸ Advanced ▸ Play Cra sound effects gates the capture shutter. |
| Theme data for websites | Settings ▸ Advanced "Allow websites to get your theme data" | missing | Arc exposes the space's palette to pages. |
@@ -36,7 +36,7 @@ or Arc-only service), per CONTRIBUTING.md.
| Archive Little Arcs after | Settings ▸ Links (6 hours default) | done | Settings ▸ Tabs ▸ Links; a Little Window left alone that long closes into the archive. |
| Previews (Gmail, Calendar on Favorites) | Settings ▸ General ▸ Previews Settings… | missing | Fetches through the browser session; nothing leaves the Mac. |
| Join Meeting ⌃⌘J | Shortcuts | missing | Needs calendar previews first. |
-| Troubleshooting menu | Help ▸ Troubleshooting: Record Trace, Open Task Manager, Reveal Arc Data, Copy Arc Info | partial | Cra has Export Diagnostics… |
+| Troubleshooting menu | Help ▸ Troubleshooting: Record Trace, Open Task Manager, Reveal Arc Data, Copy Arc Info | done | Export Diagnostics…, Open Task Manager (Chrome's), Reveal Cra Data, Copy Cra Info; Record Trace is Arc-internal. |
| Help menu | Getting Started, Release Notes, Contact the Team, Visit Help Center, Restore Data | partial | |
| Ad blocker upsell card, Sync, Account, Membership card, Share Arc, Sign Out, Send to Dia, Share Space | | *skip* | Account/cloud. |
| Max: Instant Links, 5-Second Previews, ChatGPT in the Command Bar, New ChatGPT Message ⌥⌘G | Settings ▸ Max | *skip* | AI partner (cloud). Tidy Tabs/Titles/Downloads already on-device. |
@@ -115,6 +115,7 @@ in this sweep (Essential Shortcuts window, Library pages).
- Settings ▸ Tabs ▸ Archive Little Windows after (1 hour, 6 hours, 12 hours); Settings ▸ Profiles ▸
Your Data and Settings (Chromium's privacy, passwords, cards and notifications pages per profile).
- Sidebar tab menu: Add Split View on the open tab, Open in Split View on any other.
+- View ▸ Cast… and Help ▸ Troubleshooting ▸ Open Task Manager, Chrome's own (ExecuteChromeCommand).
## Left for later, and why
@@ -122,5 +123,5 @@ in this sweep (Essential Shortcuts window, Library pages).
editor couldn't be put on screen to copy. Needs a site in Arc (Victor's OK to run the real Arc, or
a localhost server).
- Easels and Notes: whole document types with their own editors; same approach once Boosts is in.
-- AppleScript dictionary, Cast, Find and Replace, cookie banner blocking, theme data for websites,
+- AppleScript dictionary, Find and Replace, cookie banner blocking, theme data for websites,
window dragging from the top of pages, Previews and Join Meeting: not started.