-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathVMLAListener.m
More file actions
47 lines (38 loc) · 1.54 KB
/
VMLAListener.m
File metadata and controls
47 lines (38 loc) · 1.54 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
#import "TweakSB.h"
#import <libactivator/libactivator.h>
#import <objc/runtime.h>
#import <dlfcn.h>
@interface VolumeMixerLAListener: NSObject <LAListener>
@end
@implementation VolumeMixerLAListener
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event {
[hudWindow changeVisibility];
}
+ (void)load {
@autoreleasepool {
// Register listener
dlopen("/usr/lib/libactivator.dylib", RTLD_LAZY);
Class la = objc_getClass("LAActivator");
if(la) [[la sharedInstance] registerListener:[self new] forName:@"com.brend0n.volumemixer"];
}
}
- (NSString *)activator:(LAActivator *)activator requiresLocalizedGroupForListenerName:(NSString *)listenerName {
return @"VolumeMixer";
}
- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName {
return @"Show Volume Mixer";
}
- (NSString *)activator:(LAActivator *)activator requiresLocalizedDescriptionForListenerName:(NSString *)listenerName {
return @"Volume control for individual app";
}
- (UIImage *)activator:(LAActivator *)activator requiresSmallIconForListenerName:(NSString *)listenerName scale:(CGFloat)scale {
static UIImage *icon;
if(!icon) {
icon = [UIImage imageNamed:@"icon" inBundle:[NSBundle bundleWithPath:kBundlePath] compatibleWithTraitCollection:nil];
}
return icon;
}
- (NSArray *)activator:(LAActivator *)activator requiresCompatibleEventModesForListenerWithName:(NSString *)listenerName {
return @[@"springboard", @"application", @"lockscreen"];
}
@end