diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 23:27:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 23:58:31 -0300 |
| commit | cd3627307740896426830423598d2e1a8e27b024 (patch) | |
| tree | 8cb845c8da5d07c15d9d234f285bff9cffb83449 /src/macos/Sources | |
| parent | 342650183a54dcfcdce6ca4d45d6fdf48b2d1c1c (diff) | |
| download | pardes-cd3627307740896426830423598d2e1a8e27b024.tar.gz pardes-cd3627307740896426830423598d2e1a8e27b024.zip | |
settings #5, three behaviour knobs go, each the value it had by default: ProgramEsc (in a raw terminal Esc goes back a pane and Shift-Esc is the program's Esc; keys.zig's at-the-prompt Esc, which only ProgramEsc reached, goes), JumpScope (Back and Forward keep to the focused pane's file first; Jump.jumpBy's scope test goes) and WindowBlur (the macOS window draws no blur: macos.zig's pardes_window_blur, its header line, and AppDelegate.swift's NSVisualEffectView backdrop go, built nowhere here; Capabilities.window_blur with them); deleted tests: "with ProgramEsc raw tty Escape only leaves at a shell prompt", "modes: with JumpScope all, Ctrl-o and Ctrl-i take every place in the order it was jumped to, and bare JumpScope is file again", "window blur defaults off and validates without changing opacity", macos.zig's "mac window blur builtin reaches the ABI without changing opacity", and the JumpScope all half of "settings: Back and Forward written to exec keep to the focused file"; rewritten: dump's settings test on Wrap, the PDF jump test without its scope check, other-files' jump to a closed file from the +Jumps listing (no file to keep to); the reference, guide, helix-keys and macos docs lose the three; no golden changes; gates on tui: core-test 961/961, behaviour-test 240/240, unit-test 1476/1477, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1520/1521
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/macos/Sources')
| -rw-r--r-- | src/macos/Sources/AppDelegate.swift | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/src/macos/Sources/AppDelegate.swift b/src/macos/Sources/AppDelegate.swift index 3cce7592..dbc0fbc9 100644 --- a/src/macos/Sources/AppDelegate.swift +++ b/src/macos/Sources/AppDelegate.swift @@ -15,9 +15,6 @@ import AppKit final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { private var window: NSWindow! private var view: PardesView! - /// The blur behind the grid, shown only while the theme declares no - /// background of its own. See applyTheme. - private var backdrop: NSVisualEffectView! // One display-clock chain at a time. Input and pty notifications may all // call pump(), but none advances animation; they only observe this flag and // leave the already-scheduled frame alone. @@ -78,31 +75,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { // isReleasedWhenClosed on would have AppKit release it out from under // that reference the moment the close button is pressed. window.isReleasedWhenClosed = false - // The grid and the blur are SIBLINGS in a plain container, not parent - // and child. A transparent theme has to show something through the - // grid, and AppKit will not blur what is behind a window unless an - // NSVisualEffectView asks it to. The backdrop can be hidden independently - // when blur is disabled or the ground is opaque; hiding a superview hides - // its subviews with it. Nested, an opaque theme drew a blank window. let container = NSView(frame: NSRect(origin: .zero, size: want)) container.autoresizesSubviews = true - backdrop = NSVisualEffectView(frame: container.bounds) - // .underWindowBackground is the material meant for exactly this — the - // full-window wash behind content, rather than the sidebar/HUD - // materials that carry their own tint. .behindWindow is what samples - // the desktop instead of the window's own layers. - backdrop.material = .underWindowBackground - backdrop.blendingMode = .behindWindow - // .active, not .followsWindowActiveState: the grid stays readable when - // the window is not key, and a backdrop that flattens to grey on focus - // loss makes an unfocused pardes look switched off. - backdrop.state = .active - backdrop.autoresizingMask = [.width, .height] view.frame = container.bounds view.autoresizingMask = [.width, .height] - // Order matters: the blur is BEHIND the grid. - container.addSubview(backdrop) - container.addSubview(view, positioned: .above, relativeTo: backdrop) + container.addSubview(view) window.contentView = container // Trim the content box down to whole cells: a partial column or row is @@ -465,8 +442,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { /// Dress the WINDOW in what the core is wearing: the background AppKit /// paints where the view does not (the titlebar, and the strip a live - /// resize outruns), and the blur behind a theme that brings no background - /// of its own. + /// resize outruns). /// /// Cheap enough to call every pump: the view compares before it dirties /// itself, and the window properties are written only when the answer @@ -474,7 +450,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { /// theme whose background happened to equal the view's starting guess /// would otherwise leave the window in AppKit's default clothes forever. private var dressed = false - private var appliedBlur: UInt8 = 0 private func applyTheme() { // Both reads happen every pump, and neither may be short-circuited by @@ -483,16 +458,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { // tick would leave one of them unworn. let themeChanged = view.adoptThemeBG(pardes_theme_bg()) let opacityChanged = view.adoptWindowOpacity(pardes_window_opacity()) - let blur = pardes_window_blur() - let blurChanged = blur != appliedBlur - guard themeChanged || opacityChanged || blurChanged || !dressed else { return } - appliedBlur = blur - backdrop.alphaValue = CGFloat(blur) / 100 - backdrop.isHidden = blur == 0 || (view.themeBG != nil && view.backgroundAlpha >= 1) + guard themeChanged || opacityChanged || !dressed else { return } dressed = true - // Opacity paints the theme ground; blur controls the native material - // behind it. An opaque ground hides the backdrop without losing the - // requested strength, so lowering opacity restores the effect. if let rgb = view.themeBG { window.isOpaque = view.backgroundAlpha >= 1 window.backgroundColor = view.backgroundAlpha < 1 ? .clear : NSColor( @@ -509,10 +476,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, PardesViewDelegate { + 0.0722 * CGFloat(rgb & 0xFF)) / 255 window.appearance = NSAppearance(named: luma > 0.5 ? .aqua : .darkAqua) } else { - // Transparent: the window stops painting anything of its own and - // the optional blur sits behind it. isOpaque false lets the desktop - // reach the backdrop at all — a titled window is opaque by default - // and would composite over it. + // Transparent: the window stops painting anything of its own. + // isOpaque false lets the desktop show through at all — a titled + // window is opaque by default and would composite over it. window.isOpaque = false window.backgroundColor = .clear window.appearance = NSAppearance(named: .darkAqua) |
