Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Sources/App/CmuxMainWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ struct FirstMouseGatedHostingOverlay: NSViewRepresentable {
final class CmuxMainWindow: NSWindow {
private var isSoftHiddenForVisibilityController = false

// cmux renders the workspace directory icon inside its custom titlebar, whose layout follows
// the sidebar. AppKit's native proxy icon is positioned in the standard titlebar instead.
override var representedURL: URL? {
get { nil }
set { super.representedURL = nil }
}

override var representedFilename: String {
get { "" }
set { super.representedFilename = "" }
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

func setSoftHiddenForVisibilityController(_ isSoftHidden: Bool) {
isSoftHiddenForVisibilityController = isSoftHidden
if isSoftHidden {
Expand Down
34 changes: 34 additions & 0 deletions cmuxTests/WindowAndDragTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,40 @@ final class WindowAccessorTests: XCTestCase {
}
}

@MainActor
final class CmuxMainWindowTitlebarProxyIconTests: XCTestCase {
func testMainWindowSuppressesNativeRepresentedURLProxyIcon() {
_ = NSApplication.shared
let window = CmuxMainWindow(
contentRect: NSRect(x: 0, y: 0, width: 640, height: 420),
styleMask: [.titled, .closable, .resizable, .fullSizeContentView],
backing: .buffered,
defer: false
)
defer { window.close() }

let workspaceDirectory = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
window.representedURL = workspaceDirectory

XCTAssertNil(
window.representedURL,
"cmux main windows render the workspace folder icon inside the custom titlebar, so AppKit must not keep a native proxy icon at an independent titlebar position."
)
XCTAssertTrue(
window.representedFilename.isEmpty,
"Clearing the native proxy URL should also leave the legacy represented filename empty."
)

window.representedFilename = workspaceDirectory.path

XCTAssertTrue(
window.representedFilename.isEmpty,
"cmux main windows must also reject the legacy represented filename proxy icon path."
)
XCTAssertNil(window.representedURL)
}
Comment thread
lawrencecchen marked this conversation as resolved.
Resolved
}

@MainActor
final class MainWindowFocusRedrawTests: XCTestCase {
func testKeyRegainInvalidatesContentWhenPointerIsOverSidebarDivider() {
Expand Down
Loading