Skip to content

Commit

Permalink
🐛 Make preview window not show over the dock
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKai77 committed Aug 31, 2023
1 parent 18cba38 commit 77e73ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Loop/Helpers/LoopManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class LoopManager {
self.screenWithMouse = NSScreen.screenWithMouse

if Defaults[.previewVisibility] == true && frontmostWindow != nil {
previewController.show()
previewController.show(screen: self.screenWithMouse!)
}
radialMenuController.show(frontmostWindow: frontmostWindow)
keybindMonitor.start()
Expand Down
15 changes: 2 additions & 13 deletions Loop/Preview Window/PreviewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PreviewController {

var loopPreviewWindowController: NSWindowController?

func show() {
func show(screen: NSScreen) {
if let windowController = loopPreviewWindowController {
windowController.window?.orderFrontRegardless()
return
Expand All @@ -30,18 +30,7 @@ class PreviewController {
panel.alphaValue = 0
panel.orderFrontRegardless()

guard let screen = NSScreen.screenWithMouse else { return }
let menubarHeight = screen.frame.size.height - screen.visibleFrame.size.height

let screenWidth = screen.frame.size.width
let screenHeight = screen.frame.size.height - menubarHeight
let screenOriginX = screen.frame.origin.x
let screenOriginY = screen.frame.origin.y

panel.setFrame(NSRect(x: screenOriginX,
y: screenOriginY,
width: screenWidth,
height: screenHeight), display: false)
panel.setFrame(screen.visibleFrame, display: false)

loopPreviewWindowController = .init(window: panel)

Expand Down

0 comments on commit 77e73ee

Please sign in to comment.