-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: icon is tinted red while listening for a key sequence
fix: when Apptivator is disabled all sequences are unregistered
- Loading branch information
1 parent
01b486b
commit aae7baf
Showing
5 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Extensions.swift | ||
// Apptivator | ||
// | ||
|
||
// http://homecoffeecode.com/nsimage-tinted-as-easily-as-a-uiimage/ | ||
extension NSImage { | ||
func tinted(with tintColor: NSColor) -> NSImage { | ||
guard let cgImage = self.cgImage(forProposedRect: nil, context: nil, hints: nil) else { return self } | ||
|
||
return NSImage(size: size, flipped: false) { bounds in | ||
guard let context = NSGraphicsContext.current?.cgContext else { return false } | ||
tintColor.set() | ||
context.clip(to: bounds, mask: cgImage) | ||
context.fill(bounds) | ||
return true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters