-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultFolderXController.m
More file actions
36 lines (29 loc) · 1.04 KB
/
DefaultFolderXController.m
File metadata and controls
36 lines (29 loc) · 1.04 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
//
// DefaultFolderXController.m
//
// Created by Jon Gotow on 7/7/17.
// Copyright © 2017 Jon Gotow. All rights reserved.
//
#import "DefaultFolderXController.h"
@implementation DefaultFolderXController
static NSString *dfxBundleID = @"com.stclairsoft.DefaultFolderX5";
static NSString *dfxEnablePboardType = @"EnableFlag";
//-------------------------------------------------------------------------------------------------------------
// Enable or disable Default Folder X. This does nothing if Default Folder X isn't running.
+ (BOOL)setEnabled:(BOOL)enabled
{
BOOL result = NO;
if([NSRunningApplication runningApplicationsWithBundleIdentifier:dfxBundleID].count > 0) {
NSPasteboard *pb = [NSPasteboard pasteboardWithName:dfxBundleID];
[pb declareTypes:@[dfxEnablePboardType] owner:nil];
if(enabled) {
[pb setString:@"YES" forType:dfxEnablePboardType];
}
else {
[pb setString:@"NO" forType:dfxEnablePboardType];
}
result = YES;
}
return result;
}
@end