-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTomatoDock.m
34 lines (25 loc) · 1.01 KB
/
TomatoDock.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "TomatoDock.h"
#import "TomatoTimer.h"
@implementation TomatoDock
- (BOOL)isEnabled {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"TOMDock"];
}
- (void)unwatchTomato {
[super unwatchTomato];
[[[NSApplication sharedApplication] dockTile] setBadgeLabel:@""];
}
- (void)tomatoPopped:(NSNotification *)notification {
[[[NSApplication sharedApplication] dockTile] setBadgeLabel:@""];
}
- (void)tomatoTick:(NSNotification *)notification {
TomatoTimer *timer = [notification object];
if (timer.status == TOMATORUNNING) {
[[[NSApplication sharedApplication] dockTile] setBadgeLabel:[NSString stringWithFormat:@"%02d:%02d", (timer.remaining / 60), (timer.remaining % 60)]];
}
}
- (void)tomatoEnded:(NSNotification *)notification {
[[[NSApplication sharedApplication] dockTile] setBadgeLabel:@""];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"TOMDockBounce"])
[[NSApplication sharedApplication] requestUserAttention:NSCriticalRequest];
}
@end