Skip to content

Commit

Permalink
Hotfix for falsy assertion in focus.swift
Browse files Browse the repository at this point in the history
#341

The workaround replicates the workaround that was previously written in
WorkspaceCommand:

    // todo drop anyLeafWindowRecursive. It must not be necessary
    if let window = workspace.mostRecentWindow ?? workspace.anyLeafWindowRecursive { // switch to not empty workspace
        state.subject = .window(window)
    } else { // switch to empty workspace
        check(workspace.isEffectivelyEmpty)
            state.subject = .emptyWorkspace(workspaceName)
    }
  • Loading branch information
nikitabobko committed Jul 29, 2024
1 parent 3fa346d commit e03bfac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/AppBundle/focus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ extension Window {
}
extension Workspace {
func focusWorkspace() -> Bool {
if let w = mostRecentWindowRecursive {
// todo unfortunately mostRecentWindowRecursive may recursively reach empty rootTilingContainer
// while floating or macos fullscreen windows might be presented
if let w = mostRecentWindowRecursive ?? anyLeafWindowRecursive {
return w.focusWindow()
} else {
check(anyLeafWindowRecursive == nil)
return setFocus(to: LiveFocus(windowOrNil: nil, workspace: self))
}
}
Expand Down

0 comments on commit e03bfac

Please sign in to comment.