ASHUD
ASHUD copied to clipboard
Ignore Mouse Clicks, Fade Time Parameter, Future Feature Ideas
Great code, nice and simple! Was a nice springboard to work from, getting a HUD notification system working.
I would suggest in class ASHUD that the init() be made private init() to enforce its singleton nature.
Also, add window.ignoresMouseEvents = true to ASHUD.init() otherwise the HUD window can gain focus if the user clicks on it.
Some additional poking around I did with the code:
- I spent some time and added a fadeTime enum
[.defaultDuration, .noFade, .withDuration(Double)]and added it as a parameter tofunc showHUDso you can easily set a fade-out duration with a default of 0.2 seconds. Fun! - I also did a bit of housekeeping and added min/max constraints on the delay time and fade time so they can't be less than zero or more than 5 seconds.
- I also upgraded the code to Swift 3.
Future ideas:
- Would be cool to add image support (by way of NSImage passed as a parameter or a user-created image enumeration) to the notifications instead of just text!
- A queuing manager/system when there are two or more showHUD calls in a very short amount of time (ie: if a notification is called before a previous one has disappeared)
Sorry, I'm a bit new to github and don't know how to contribute with pull requests. But I really appreciate your work!
@orchetect Nice suggestions ! Follow this , you can contribute the pull requests : https://help.github.com/articles/creating-a-pull-request/ https://help.github.com/articles/using-pull-requests/ Waitting for your code !