macOS - Window Top Most on Screen

@Patric_Lee_Atrott You want the window to have the floating window level and to be “managed” (participate in Mission Control).

#If TargetMacOS
  Var nsw As NSWindowMBS = Self.NSWindowMBS
  If nsw Is Nil Then Return
  If enable Then
    nsw.Level = NSWindowMBS.NSFloatingWindowLevel
    nsw.collectionBehavior = NSWindowMBS.NSWindowCollectionBehaviorManaged _ // window appears in Mission Control, like Stickies
    Or NSWindowMBS.NSWindowCollectionBehaviorIgnoresCycle _                // window excluded from Cmd-` cycling, like Stickies
    Or NSWindowMBS.NSWindowCollectionBehaviorMoveToActiveSpace
    nsw.orderFrontRegardless()
  Else
    // FULL reset to normal window behavior
    nsw.Level = NSWindowMBS.NSNormalWindowLevel
    nsw.CollectionBehavior = NSWindowMBS.NSWindowCollectionBehaviorDefault
    nsw.OrderFront()
  End If
  nsw.HidesOnDeactivate = False
#EndIf
2 Likes