Window visible on all spaces (including other fullscreen apps)

前端 未结 2 422
梦谈多话
梦谈多话 2021-02-04 14:12

I\'m trying to make a window (NSWindow) visible on all the spaces including other full screen app windows. I\'ve been trying to set a higher window level as well as playing with

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 15:06

    You're on the right track in a way, you need to set your window object's level to one level above the Shield Window's to be in the the forefront:

            window.level = Int(CGShieldingWindowLevel()) + 1
    

    Do note that this technique is not really recommended as some problems might arise from the interaction between full-screen graphics (OpenGL full-screen drawing contexts is an example) and the graphics hardware; but it's your best bet if you want to ensure overlay on top of all other applications.

提交回复
热议问题