Skip to content

Commit 8ba5116

Browse files
committed
v3.1.3
1 parent aeacc3e commit 8ba5116

File tree

18 files changed

+204
-149
lines changed

18 files changed

+204
-149
lines changed

FinderOpen/FinderOpen.swift

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,72 +9,76 @@ import Cocoa
99
import FinderSync
1010

1111
class FinderOpen: FIFinderSync {
12-
12+
1313
private var directoriesToWatch: Set<URL> = []
1414

1515
override init() {
1616
super.init()
1717
NSLog("FinderSync() launched from %@", Bundle.main.bundlePath as NSString)
18-
19-
// Set up initial directory URLs including all mounted volumes
18+
19+
// Set up initial directory URLs and volume monitoring based on settings
2020
updateWatchedDirectories()
21-
22-
// Register for volume mount/unmount notifications
23-
setupVolumeMonitoring()
2421
}
25-
22+
2623
private func updateWatchedDirectories() {
2724
directoriesToWatch = [URL(fileURLWithPath: "/")]
28-
29-
// Add all currently mounted volumes
30-
if let mountedVolumes = FileManager.default.mountedVolumeURLs(
31-
includingResourceValuesForKeys: nil,
32-
options: [.skipHiddenVolumes]
33-
) {
34-
for volume in mountedVolumes {
35-
directoriesToWatch.insert(volume)
25+
26+
// Only add mounted volumes and set up monitoring if the setting is enabled
27+
if UserDefaults.enableMountedVolumesSync {
28+
if let mountedVolumes = FileManager.default.mountedVolumeURLs(
29+
includingResourceValuesForKeys: nil,
30+
options: [.skipHiddenVolumes]
31+
) {
32+
for volume in mountedVolumes {
33+
directoriesToWatch.insert(volume)
34+
}
3635
}
36+
37+
// Set up volume monitoring only if mounted volumes sync is enabled
38+
setupVolumeMonitoring()
3739
}
38-
40+
3941
FIFinderSyncController.default().directoryURLs = directoriesToWatch
40-
NSLog("FinderSync watching directories: %@", directoriesToWatch.map { $0.path }.joined(separator: ", "))
42+
NSLog(
43+
"FinderSync watching directories: %@",
44+
directoriesToWatch.map { $0.path }.joined(separator: ", "))
4145
}
42-
46+
4347
private func setupVolumeMonitoring() {
4448
let notificationCenter = NSWorkspace.shared.notificationCenter
45-
49+
4650
// Monitor volume mount events
4751
notificationCenter.addObserver(
4852
forName: NSWorkspace.didMountNotification,
4953
object: nil,
5054
queue: .main
5155
) { [weak self] notification in
5256
guard let self = self else { return }
53-
57+
5458
if let volumeURL = notification.userInfo?[NSWorkspace.volumeURLUserInfoKey] as? URL {
5559
NSLog("FinderSync: Volume mounted at %@", volumeURL.path)
56-
60+
5761
self.directoriesToWatch.insert(volumeURL)
5862
FIFinderSyncController.default().directoryURLs = self.directoriesToWatch
59-
63+
6064
NSLog("FinderSync: Added volume to watched directories")
6165
}
6266
}
63-
67+
6468
// Monitor volume unmount events
6569
notificationCenter.addObserver(
6670
forName: NSWorkspace.didUnmountNotification,
6771
object: nil,
6872
queue: .main
6973
) { [weak self] notification in
7074
guard let self = self else { return }
71-
75+
7276
if let volumeURL = notification.userInfo?[NSWorkspace.volumeURLUserInfoKey] as? URL {
7377
NSLog("FinderSync: Volume unmounted at %@", volumeURL.path)
74-
78+
7579
self.directoriesToWatch.remove(volumeURL)
7680
FIFinderSyncController.default().directoryURLs = self.directoriesToWatch
77-
81+
7882
NSLog("FinderSync: Removed volume from watched directories")
7983
}
8084
}
@@ -87,9 +91,21 @@ class FinderOpen: FIFinderSync {
8791
if menuKind == .contextualMenuForItems {
8892
// Get the selected items
8993
if let selectedItemURLs = FIFinderSyncController.default().selectedItemURLs(),
90-
selectedItemURLs.count == 1, selectedItemURLs.first?.pathExtension == "app" {
94+
selectedItemURLs.count == 1, selectedItemURLs.first?.pathExtension == "app"
95+
{
9196
// Add menu item if the selected item is a .app file
92-
let menuItem = NSMenuItem(title: String(localized: "Sentinel Unquarantine"), action: #selector(openInMyApp), keyEquivalent: "")
97+
let menuItem = NSMenuItem(
98+
title: String(localized: "Sentinel Unquarantine"),
99+
action: #selector(openInMyApp), keyEquivalent: "")
100+
101+
// Set app icon if enabled
102+
if UserDefaults.showAppIconInMenu {
103+
if let appIcon = NSApp.applicationIconImage {
104+
appIcon.size = NSSize(width: 16, height: 16)
105+
menuItem.image = appIcon
106+
}
107+
}
108+
93109
menu.addItem(menuItem)
94110

95111
}
@@ -102,7 +118,9 @@ class FinderOpen: FIFinderSync {
102118

103119
@objc func openInMyApp(_ sender: AnyObject?) {
104120
// Get the selected items (files/folders) in Finder
105-
guard let selectedItems = FIFinderSyncController.default().selectedItemURLs(), !selectedItems.isEmpty else {
121+
guard let selectedItems = FIFinderSyncController.default().selectedItemURLs(),
122+
!selectedItems.isEmpty
123+
else {
106124
return
107125
}
108126

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<br />
55
<strong>Status: </strong>Maintained
66
<br />
7-
<strong>Version: </strong>3.1.2
7+
<strong>Version: </strong>3.1.3
88
<br />
99
<a href="https://github.com/alienator88/Sentinel/releases"><strong>Download</strong></a>
1010
·

Sentinel.xcodeproj/project.pbxproj

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
/* Begin PBXBuildFile section */
1010
4180AEAE2839753E0054FEA9 /* SentinelApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4180AEAD2839753E0054FEA9 /* SentinelApp.swift */; };
11-
4180AEB22839753F0054FEA9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4180AEB12839753F0054FEA9 /* Assets.xcassets */; };
1211
4180AEEB2839A0280054FEA9 /* AboutCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4180AEEA2839A0280054FEA9 /* AboutCommand.swift */; };
1312
4180AEFB2839A32F0054FEA9 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4180AEFA2839A32F0054FEA9 /* AboutView.swift */; };
1413
C708899C2DB42F8800AC3E2B /* DropDelegates.swift in Sources */ = {isa = PBXBuildFile; fileRef = C708899B2DB42F8200AC3E2B /* DropDelegates.swift */; };
@@ -19,12 +18,13 @@
1918
C744585F2E382B9500B8D6F1 /* FinderOpen.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = C74458572E382B9500B8D6F1 /* FinderOpen.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
2019
C74458672E3830E300B8D6F1 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C74458662E3830E000B8D6F1 /* Utilities.swift */; };
2120
C744586F2E38356400B8D6F1 /* DeepLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = C744586E2E38356200B8D6F1 /* DeepLink.swift */; };
22-
C74458732E383D4B00B8D6F1 /* announcements.json in Resources */ = {isa = PBXBuildFile; fileRef = C74458722E383D4B00B8D6F1 /* announcements.json */; };
2321
C78AAAB32BB33F84002AD918 /* UpdateSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78AAAB22BB33F84002AD918 /* UpdateSettingsView.swift */; };
2422
C78AAAB52BB33F9A002AD918 /* Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78AAAB42BB33F9A002AD918 /* Styles.swift */; };
2523
C78AAAB92BB3418E002AD918 /* SettingsWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78AAAB82BB3418E002AD918 /* SettingsWindow.swift */; };
2624
C7BB802A29CA28B400006CDB /* Dashboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BB802929CA28B400006CDB /* Dashboard.swift */; };
2725
C7BB802C29CA299700006CDB /* CmdDrops.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BB802B29CA299700006CDB /* CmdDrops.swift */; };
26+
C7BEBE1F2E846A8B00B56DE9 /* Sentinel.icon in Resources */ = {isa = PBXBuildFile; fileRef = C7374B662E79C8110015DEED /* Sentinel.icon */; };
27+
C7BEBE212E846AB400B56DE9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7BEBE202E846AB400B56DE9 /* Assets.xcassets */; };
2828
C7EB1E0A2C594BD50085B695 /* AlinFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = C7EB1E092C594BD50085B695 /* AlinFoundation */; };
2929
C7FBD9EA2DAD722700151934 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7FBD9E92DAD721F00151934 /* GeneralSettingsView.swift */; };
3030
/* End PBXBuildFile section */
@@ -56,7 +56,6 @@
5656
/* Begin PBXFileReference section */
5757
4180AEAA2839753E0054FEA9 /* Sentinel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sentinel.app; sourceTree = BUILT_PRODUCTS_DIR; };
5858
4180AEAD2839753E0054FEA9 /* SentinelApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentinelApp.swift; sourceTree = "<group>"; };
59-
4180AEB12839753F0054FEA9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6059
4180AEB62839753F0054FEA9 /* SentinelApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SentinelApp.entitlements; sourceTree = "<group>"; };
6160
4180AEEA2839A0280054FEA9 /* AboutCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutCommand.swift; sourceTree = "<group>"; };
6261
4180AEFA2839A32F0054FEA9 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
@@ -76,6 +75,7 @@
7675
C78AAAB82BB3418E002AD918 /* SettingsWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsWindow.swift; sourceTree = "<group>"; };
7776
C7BB802929CA28B400006CDB /* Dashboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dashboard.swift; sourceTree = "<group>"; };
7877
C7BB802B29CA299700006CDB /* CmdDrops.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CmdDrops.swift; sourceTree = "<group>"; };
78+
C7BEBE202E846AB400B56DE9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7979
C7FBD9E92DAD721F00151934 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
8080
/* End PBXFileReference section */
8181

@@ -87,10 +87,18 @@
8787
);
8888
target = C74458562E382B9500B8D6F1 /* FinderOpen */;
8989
};
90+
C7BEBE1E2E84694900B56DE9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = {
91+
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
92+
membershipExceptions = (
93+
AppGroupDefaults.swift,
94+
);
95+
target = 4180AEA92839753E0054FEA9 /* Sentinel */;
96+
};
9097
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
9198

9299
/* Begin PBXFileSystemSynchronizedRootGroup section */
93100
C74458582E382B9500B8D6F1 /* FinderOpen */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (C74458602E382B9500B8D6F1 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = FinderOpen; sourceTree = "<group>"; };
101+
C7BEBE1A2E84693400B56DE9 /* Shared */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (C7BEBE1E2E84694900B56DE9 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Shared; sourceTree = "<group>"; };
94102
/* End PBXFileSystemSynchronizedRootGroup section */
95103

96104
/* Begin PBXFrameworksBuildPhase section */
@@ -115,6 +123,7 @@
115123
4180AEA12839753E0054FEA9 = {
116124
isa = PBXGroup;
117125
children = (
126+
C7BEBE1A2E84693400B56DE9 /* Shared */,
118127
4180AEAC2839753E0054FEA9 /* Sentinel */,
119128
C74458582E382B9500B8D6F1 /* FinderOpen */,
120129
4180AEAB2839753E0054FEA9 /* Products */,
@@ -140,11 +149,11 @@
140149
C78AAAAD2BB33F2E002AD918 /* Settings */,
141150
4180AEEC2839A0560054FEA9 /* Utilities */,
142151
4180AEAD2839753E0054FEA9 /* SentinelApp.swift */,
143-
4180AEB12839753F0054FEA9 /* Assets.xcassets */,
144152
C7374B662E79C8110015DEED /* Sentinel.icon */,
145153
4180AEB62839753F0054FEA9 /* SentinelApp.entitlements */,
146154
C733F76E29CA65AC00DADADD /* AppState.swift */,
147155
C78AAAB42BB33F9A002AD918 /* Styles.swift */,
156+
C7BEBE202E846AB400B56DE9 /* Assets.xcassets */,
148157
);
149158
path = Sentinel;
150159
sourceTree = "<group>";
@@ -213,6 +222,7 @@
213222
);
214223
fileSystemSynchronizedGroups = (
215224
C74458582E382B9500B8D6F1 /* FinderOpen */,
225+
C7BEBE1A2E84693400B56DE9 /* Shared */,
216226
);
217227
name = FinderOpen;
218228
packageProductDependencies = (
@@ -265,16 +275,16 @@
265275
isa = PBXResourcesBuildPhase;
266276
buildActionMask = 2147483647;
267277
files = (
268-
C74458732E383D4B00B8D6F1 /* announcements.json in Resources */,
278+
C7BEBE212E846AB400B56DE9 /* Assets.xcassets in Resources */,
269279
C7374B672E79C8110015DEED /* Sentinel.icon in Resources */,
270-
4180AEB22839753F0054FEA9 /* Assets.xcassets in Resources */,
271280
);
272281
runOnlyForDeploymentPostprocessing = 0;
273282
};
274283
C74458552E382B9500B8D6F1 /* Resources */ = {
275284
isa = PBXResourcesBuildPhase;
276285
buildActionMask = 2147483647;
277286
files = (
287+
C7BEBE1F2E846A8B00B56DE9 /* Sentinel.icon in Resources */,
278288
);
279289
runOnlyForDeploymentPostprocessing = 0;
280290
};
@@ -454,7 +464,7 @@
454464
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
455465
CODE_SIGN_STYLE = Manual;
456466
COMBINE_HIDPI_IMAGES = YES;
457-
CURRENT_PROJECT_VERSION = 17;
467+
CURRENT_PROJECT_VERSION = 18;
458468
DEAD_CODE_STRIPPING = YES;
459469
DEVELOPMENT_ASSET_PATHS = "";
460470
DEVELOPMENT_TEAM = "";
@@ -473,11 +483,12 @@
473483
"@executable_path/../Frameworks",
474484
);
475485
MACOSX_DEPLOYMENT_TARGET = 13.0;
476-
MARKETING_VERSION = 3.1.2;
486+
MARKETING_VERSION = 3.1.3;
477487
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Sentinel;
478488
PRODUCT_NAME = "$(TARGET_NAME)";
479489
PROVISIONING_PROFILE_SPECIFIER = "";
480490
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "M1 Pro Signed - Sentinel";
491+
REGISTER_APP_GROUPS = YES;
481492
SWIFT_EMIT_LOC_STRINGS = YES;
482493
SWIFT_VERSION = 5.0;
483494
};
@@ -493,7 +504,7 @@
493504
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
494505
CODE_SIGN_STYLE = Manual;
495506
COMBINE_HIDPI_IMAGES = YES;
496-
CURRENT_PROJECT_VERSION = 17;
507+
CURRENT_PROJECT_VERSION = 18;
497508
DEAD_CODE_STRIPPING = YES;
498509
DEVELOPMENT_ASSET_PATHS = "";
499510
DEVELOPMENT_TEAM = "";
@@ -512,11 +523,12 @@
512523
"@executable_path/../Frameworks",
513524
);
514525
MACOSX_DEPLOYMENT_TARGET = 13.0;
515-
MARKETING_VERSION = 3.1.2;
526+
MARKETING_VERSION = 3.1.3;
516527
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Sentinel;
517528
PRODUCT_NAME = "$(TARGET_NAME)";
518529
PROVISIONING_PROFILE_SPECIFIER = "";
519530
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "M1 Pro Signed - Sentinel";
531+
REGISTER_APP_GROUPS = YES;
520532
SWIFT_EMIT_LOC_STRINGS = YES;
521533
SWIFT_VERSION = 5.0;
522534
};
@@ -531,7 +543,7 @@
531543
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
532544
CODE_SIGN_STYLE = Manual;
533545
COMBINE_HIDPI_IMAGES = YES;
534-
CURRENT_PROJECT_VERSION = 17;
546+
CURRENT_PROJECT_VERSION = 18;
535547
DEVELOPMENT_TEAM = "";
536548
"DEVELOPMENT_TEAM[sdk=macosx*]" = BK8443AXLU;
537549
ENABLE_HARDENED_RUNTIME = YES;
@@ -547,7 +559,7 @@
547559
);
548560
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
549561
MACOSX_DEPLOYMENT_TARGET = 13.0;
550-
MARKETING_VERSION = 3.1.2;
562+
MARKETING_VERSION = 3.1.3;
551563
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Sentinel;
552564
PRODUCT_NAME = "$(TARGET_NAME)";
553565
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -569,7 +581,7 @@
569581
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
570582
CODE_SIGN_STYLE = Manual;
571583
COMBINE_HIDPI_IMAGES = YES;
572-
CURRENT_PROJECT_VERSION = 17;
584+
CURRENT_PROJECT_VERSION = 18;
573585
DEVELOPMENT_TEAM = "";
574586
"DEVELOPMENT_TEAM[sdk=macosx*]" = BK8443AXLU;
575587
ENABLE_HARDENED_RUNTIME = YES;
@@ -585,7 +597,7 @@
585597
);
586598
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
587599
MACOSX_DEPLOYMENT_TARGET = 13.0;
588-
MARKETING_VERSION = 3.1.2;
600+
MARKETING_VERSION = 3.1.3;
589601
PRODUCT_BUNDLE_IDENTIFIER = com.alienator88.Sentinel;
590602
PRODUCT_NAME = "$(TARGET_NAME)";
591603
PROVISIONING_PROFILE_SPECIFIER = "";
Binary file not shown.

0 commit comments

Comments
 (0)