Skip to content

Commit

Permalink
Small fix for behaviour when Pika is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
superhighfives committed Mar 5, 2021
1 parent dc89795 commit bc1118d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Pika/Utilities/Eyedroppers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Eyedropper: ObservableObject {
}

let type: Types
var forceShow = false

@objc @Published public var color: NSColor

Expand All @@ -29,6 +30,9 @@ class Eyedropper: ObservableObject {

func start() {
if Defaults[.hidePikaWhilePicking] {
if NSApp.mainWindow?.isVisible == true {
forceShow = true
}
NSApp.sendAction(#selector(AppDelegate.hidePika), to: nil, from: nil)
}

Expand All @@ -37,8 +41,11 @@ class Eyedropper: ObservableObject {
sampler.show { selectedColor in

if let selectedColor = selectedColor {
NSApp.sendAction(#selector(AppDelegate.showPika), to: nil, from: nil)
self.color = selectedColor.usingColorSpace(Defaults[.colorSpace])!
NSApp.sendAction(#selector(AppDelegate.showPika), to: nil, from: nil)
} else if self.forceShow {
self.forceShow = false
NSApp.sendAction(#selector(AppDelegate.showPika), to: nil, from: nil)
}
}
}
Expand Down

0 comments on commit bc1118d

Please sign in to comment.