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.

Sidebar backdrop: substitute colour while the capture rebuilds, desktop tint in fullscreen (#99)

Victor Kildahle358e187c8f3
diff --git a/Sources/Cra/UI/ShellView.swift b/Sources/Cra/UI/ShellView.swift
index 6927720..1da82dd 100644
--- a/Sources/Cra/UI/ShellView.swift
+++ b/Sources/Cra/UI/ShellView.swift
@@ -15,6 +15,12 @@ final class ShellView: NSView {
/// them (docs, 25 Oct 2026). Falls back to `vibrancy` when the layer class is missing.
let backdropHost = NSView()
private var backdropLayer: CALayer?
+ /// In fullscreen there is nothing behind the window to capture (the backdrop read black),
+ /// so NSVisualEffectView, and with it Arc's sidebar, swaps its capture for the desktop
+ /// tint (CAChameleonLayer). We do the same (GitHub #83).
+ private var desktopTintLayer: CALayer?
+ var windowFullscreen = false { didSet { if windowFullscreen != oldValue { refreshLift() } } }
+ private var loggedBackdrop: String?
private let dimLayer = CALayer()
private let liftLayer = CAGradientLayer()
/// Set by the window controller: light theme that wants the blur path.
@@ -136,12 +142,22 @@ final class ShellView: NSView {
vibrancyLift.isHidden = true
backdropHost.isHidden = false
CATransaction.begin(); CATransaction.setDisableActions(true)
+ let tint = windowFullscreen && desktopTintLayer != nil
+ backdropLayer?.isHidden = tint
+ desktopTintLayer?.isHidden = !tint
// Solid: Arc's material is grey 66 passing 52 % of the backdrop, flat 212 while inactive.
dimLayer.opacity = Float(solidBackdrop ? (windowActive ? 0.30 : 1) : windowActive ? t.blurDim : t.blurDimInactive)
let top = solidBackdrop ? (windowActive ? 0.26 : 0.83) : windowActive ? t.liftActive : t.liftInactive
let bottom = solidBackdrop ? top : windowActive ? t.liftActiveBottom : t.liftInactive
liftLayer.colors = [NSColor(white: 1, alpha: top).cgColor, NSColor(white: 1, alpha: bottom).cgColor]
CATransaction.commit()
+ // One line per change, so a report of a sharp or off-colour sidebar can be matched
+ // to the window's state in cra.log.
+ let state = "\(tint ? "desktop tint" : "blur"), \(windowActive ? "active" : "inactive")"
+ if state != loggedBackdrop {
+ loggedBackdrop = state
+ CraLog.note("sidebar backdrop: " + state)
+ }
} else {
backdropHost.isHidden = true
vibrancyLift.isHidden = false
@@ -186,8 +202,18 @@ final class ShellView: NSView {
b.filters = [blur]
b.setValue(true, forKey: "windowServerAware")
b.setValue("NSCGSWindowBehindWindowCaptureBackdropGroup", forKey: "groupName")
+ // While the window server rebuilds the capture (activation, a Space switch) the
+ // layer showed the stale, unblurred backdrop: the window behind, sharp (GitHub
+ // #83). NSVisualEffectView's own layer allows a substitute colour for that time.
+ if b.responds(to: NSSelectorFromString("setAllowsSubstituteColor:")) { b.setValue(true, forKey: "allowsSubstituteColor") }
backdropHost.layer?.addSublayer(b)
backdropLayer = b
+ if let tintClass = NSClassFromString("CAChameleonLayer") as? CALayer.Type {
+ let t = tintClass.init()
+ t.isHidden = true
+ backdropHost.layer?.addSublayer(t)
+ desktopTintLayer = t
+ }
}
dimLayer.backgroundColor = NSColor.black.cgColor
backdropHost.layer?.addSublayer(dimLayer)
@@ -509,6 +535,7 @@ final class ShellView: NSView {
backdropHost.frame = bounds
CATransaction.begin(); CATransaction.setDisableActions(true)
backdropLayer?.frame = backdropHost.bounds
+ desktopTintLayer?.frame = backdropHost.bounds
dimLayer.frame = backdropHost.bounds
liftLayer.frame = backdropHost.bounds
CATransaction.commit()
diff --git a/Sources/Cra/UI/Windows/MainWindowController.swift b/Sources/Cra/UI/Windows/MainWindowController.swift
index 3fd12c5..80230ef 100644
--- a/Sources/Cra/UI/Windows/MainWindowController.swift
+++ b/Sources/Cra/UI/Windows/MainWindowController.swift
@@ -2321,8 +2321,8 @@ final class MainWindowController: NSWindowController, NSWindowDelegate, BrowserM
}
// The sidebar header's toggle moves into the traffic lights' place while they are gone (Arc).
- func windowWillEnterFullScreen(_ notification: Notification) { sidebarUI.windowFullscreen = true }
- func windowWillExitFullScreen(_ notification: Notification) { sidebarUI.windowFullscreen = false }
+ func windowWillEnterFullScreen(_ notification: Notification) { sidebarUI.windowFullscreen = true; shell.windowFullscreen = true }
+ func windowWillExitFullScreen(_ notification: Notification) { sidebarUI.windowFullscreen = false; shell.windowFullscreen = false }
func windowDidEnterFullScreen(_ notification: Notification) { shell.needsLayout = true }
func windowDidExitFullScreen(_ notification: Notification) {
// Left with the green button or ⌃⌘F while a video was fullscreen: the page leaves too.
diff --git a/docs/arc-reverse-engineering.md b/docs/arc-reverse-engineering.md
index d8553f3..8ac6c19 100644
--- a/docs/arc-reverse-engineering.md
+++ b/docs/arc-reverse-engineering.md
@@ -1815,6 +1815,24 @@ Theme palettes in a hand-built space can be borrowed; only the `background` styl
0.30, lift 0.26; inactive dim 1, lift 0.83) matches all 22 test spaces within 2/255 over both backdrops, except
intensity 0 over white (19/255 light). A space with no `windowTheme` is Arc's default dark purple; the import
uses Ink instead of the next preset.
+- [O] Sidebar backdrop through activation and fullscreen (2 Nov 2026, issue #83; Arc 1.171, 1x external display,
+ ~56 fps `screencapture -v` recordings, a probe app with Cra's layer next to NSVisualEffectView panels over a
+ 6 pt stripe window). Arc's sidebar is an NSVisualEffectView (`behindWindowBlurView`). Its layer tree, dumped
+ from a probe: inactive = no CABackdropLayer at all, an opaque fill; active windowed = a CABackdropLayer with
+ `allowsSubstituteColor` 1 (Cra's had 0); active fullscreen = the backdrop removed and a `CAChameleonLayer`
+ "desktop tint" at opacity 1 in its place, with the same filters as the blur (hudWindow: sdrNormalize,
+ colorSaturate 1.6). In fullscreen there is nothing behind the window, so Cra's capture read black: black at
+ intensity 1 sat at 17/17/17, NSVisualEffectView over the same wallpaper at 130/102/84, raw tint 186/156/135.
+ Victor's light vibrant theme fullscreen, same display and wallpaper: Arc 207/169/112 (top) … 215/161/105,
+ Cra before 69/64/47 … 78/66/47, Cra with the tint 192/176/129 … 207/171/123 (Arc saturates the tint, Cra's
+ untinted blur path doesn't). A capture that isn't live (probe: `windowServerAware` off) shows the window behind
+ sharp and legible; the same layer with `allowsSubstituteColor` draws a flat fill instead. Arc switches active ↔
+ inactive in one frame, no fade. Cra: `ShellView` allows the substitute colour and swaps in the desktop tint while
+ the window is fullscreen; `cra.log` notes each change ("sidebar backdrop: desktop tint, active"). Cra before the
+ change kept a stale, hard-edged backdrop for seconds after launch and activation in 2 of 3 runs, the changed
+ build in none of 3 (other sessions' windows moved between runs, so take that as a hint). Not seen here: the
+ sharp sidebar on activation from Mission Control, Finder or a fullscreen Space (1x displays).
+ `screencapture` stills are no use for this: they disagreed with recordings of the same state.
- [O] Tab list scroller: AppKit overlay scroller (AXScrollBar, 17 pt track) shown while scrolling, then faded;
the knob is 4 pt wide, 3 pt in from the sidebar edge, white 49 % on a dark theme, no track. Cra:
`SidebarScroller`, 10 pt wide so it stays in the gutter right of the rows (knob on Arc's exact columns).