Dock.m 749 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Dock.m
  3. // MG
  4. //
  5. // Created by Tim Debo on 5/22/14.
  6. //
  7. //
  8. #import "Dock.h"
  9. @implementation Dock
  10. - (JSValue *)badge {
  11. NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
  12. return [JSValue valueWithObject:[tile badgeLabel] inContext:JSContext.currentContext];
  13. }
  14. - (void)addBadge:(NSString *)badge {
  15. NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
  16. [tile setBadgeLabel:badge];
  17. }
  18. - (void)removeBadge {
  19. NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
  20. [tile setBadgeLabel:nil];
  21. }
  22. - (void)hideIcon {
  23. [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
  24. }
  25. - (void)showIcon {
  26. [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
  27. }
  28. @end