mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: reset the process lock when clearing the process view (#977)
This commit is contained in:
@@ -771,16 +771,7 @@ public class ProcessView: NSStackView {
|
||||
}
|
||||
|
||||
public override func mouseDown(with: NSEvent) {
|
||||
self.lock = !self.lock
|
||||
if self.lock {
|
||||
self.imageView.isHidden = true
|
||||
self.killView.isHidden = false
|
||||
self.layer?.backgroundColor = .init(gray: 0.01, alpha: 0.1)
|
||||
} else {
|
||||
self.imageView.isHidden = false
|
||||
self.killView.isHidden = true
|
||||
self.layer?.backgroundColor = .none
|
||||
}
|
||||
self.setLock(!self.lock)
|
||||
}
|
||||
|
||||
public func set(_ process: TopProcess, _ value: String) {
|
||||
@@ -798,9 +789,23 @@ public class ProcessView: NSStackView {
|
||||
self.valueView.stringValue = ""
|
||||
self.imageView.image = nil
|
||||
self.pid = nil
|
||||
self.setLock(false)
|
||||
self.toolTip = ""
|
||||
}
|
||||
|
||||
private func setLock(_ state: Bool) {
|
||||
self.lock = state
|
||||
if self.lock {
|
||||
self.imageView.isHidden = true
|
||||
self.killView.isHidden = false
|
||||
self.layer?.backgroundColor = .init(gray: 0.01, alpha: 0.1)
|
||||
} else {
|
||||
self.imageView.isHidden = false
|
||||
self.killView.isHidden = true
|
||||
self.layer?.backgroundColor = .none
|
||||
}
|
||||
}
|
||||
|
||||
@objc public func kill() {
|
||||
if let pid = self.pid {
|
||||
asyncShell("kill \(pid)")
|
||||
|
||||
Reference in New Issue
Block a user