Skip to content

Commit

Permalink
Hide dock tile when not showing progress
Browse files Browse the repository at this point in the history
Fixes #20
  • Loading branch information
sindresorhus committed Mar 30, 2024
1 parent fb80c50 commit d4f23b5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/DockProgress/DockProgress.swift
Expand Up @@ -107,6 +107,7 @@ public enum DockProgress {
public static var progress: Double = 0 {
didSet {
if progress > 0 {
NSApp.dockTile.contentView = dockContentView
displayLinkObserver.start()
} else {
updateDockIcon()
Expand All @@ -117,7 +118,13 @@ public enum DockProgress {
/**
The currently displayed progress. Animates towards ``progress``.
*/
public private(set) static var displayedProgress = 0.0
public private(set) static var displayedProgress = 0.0 {
didSet {
if displayedProgress == 0 || displayedProgress >= 1 {
NSApp.dockTile.contentView = nil
}
}
}

/**
Reset the progress without animating.
Expand Down

0 comments on commit d4f23b5

Please sign in to comment.