Prepared incognito mode preferences

This commit is contained in:
Michael Starke
2021-11-10 19:32:29 +01:00
parent bb38973fa7
commit 5d4d0a626b
5 changed files with 118 additions and 58 deletions

View File

@@ -20,38 +20,25 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="449" height="418"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="449" height="478"/>
<subviews>
<box autoresizesSubviews="NO" horizontalHuggingPriority="249" verticalHuggingPriority="500" borderType="line" title="Entry Table" translatesAutoresizingMaskIntoConstraints="NO" id="2">
<rect key="frame" x="17" y="272" width="415" height="98"/>
<rect key="frame" x="17" y="272" width="415" height="104"/>
<view key="contentView" id="cfa-nq-Kzt">
<rect key="frame" x="3" y="3" width="409" height="80"/>
<rect key="frame" x="3" y="3" width="409" height="86"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9">
<rect key="frame" x="18" y="53" width="134" height="16"/>
<rect key="frame" x="18" y="49" width="134" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Double-click on URL:" id="10">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="13">
<rect key="frame" x="155" y="46" width="110" height="25"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="14">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="15">
<items>
<menuItem title="Copies URL" id="16"/>
<menuItem title="Opens URL" id="17"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="36">
<rect key="frame" x="18" y="23" width="134" height="16"/>
<rect key="frame" x="18" y="19" width="134" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Double-click on Title:" id="37">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -59,7 +46,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="40">
<rect key="frame" x="155" y="16" width="140" height="25"/>
<rect key="frame" x="155" y="16" width="140" height="21"/>
<popUpButtonCell key="cell" type="push" title="Opens Inspector" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="44" id="41">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -71,47 +58,39 @@
</menu>
</popUpButtonCell>
</popUpButton>
<popUpButton verticalHuggingPriority="750" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="13">
<rect key="frame" x="155" y="42" width="110" height="25"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="14">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="15">
<items>
<menuItem title="Copies URL" id="16"/>
<menuItem title="Opens URL" id="17"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
</subviews>
<constraints>
<constraint firstItem="13" firstAttribute="top" secondItem="cfa-nq-Kzt" secondAttribute="top" constant="20" symbolic="YES" id="0iU-Bj-QtG"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="40" secondAttribute="trailing" constant="20" symbolic="YES" id="3iK-WD-tbs"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="13" secondAttribute="trailing" constant="20" symbolic="YES" id="EQn-DK-viK"/>
<constraint firstItem="9" firstAttribute="leading" secondItem="cfa-nq-Kzt" secondAttribute="leading" constant="20" symbolic="YES" id="FHR-zo-tjR"/>
<constraint firstItem="9" firstAttribute="firstBaseline" secondItem="13" secondAttribute="firstBaseline" id="Swb-ay-7G0"/>
<constraint firstItem="36" firstAttribute="firstBaseline" secondItem="40" secondAttribute="firstBaseline" id="dWh-SS-Sc4"/>
<constraint firstItem="36" firstAttribute="leading" secondItem="cfa-nq-Kzt" secondAttribute="leading" constant="20" symbolic="YES" id="eqy-R2-mpP"/>
<constraint firstAttribute="bottom" secondItem="40" secondAttribute="bottom" constant="20" symbolic="YES" id="lle-u8-JWP"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="40" secondAttribute="bottom" constant="20" symbolic="YES" id="lle-u8-JWP"/>
</constraints>
</view>
<constraints>
<constraint firstItem="13" firstAttribute="leading" secondItem="9" secondAttribute="trailing" constant="8" symbolic="YES" id="1WE-nm-pp2"/>
<constraint firstItem="13" firstAttribute="top" secondItem="2" secondAttribute="top" constant="25" id="Nd9-4H-y8b"/>
<constraint firstAttribute="height" constant="100" id="AfY-wN-l34"/>
<constraint firstItem="40" firstAttribute="top" secondItem="13" secondAttribute="bottom" constant="10" symbolic="YES" id="YWX-K2-P8C"/>
<constraint firstItem="13" firstAttribute="leading" secondItem="40" secondAttribute="leading" id="mih-x6-1K0"/>
<constraint firstItem="40" firstAttribute="leading" secondItem="36" secondAttribute="trailing" constant="8" symbolic="YES" id="tsy-wg-saI"/>
</constraints>
</box>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ehI-gq-lsb">
<rect key="frame" x="112" y="374" width="136" height="25"/>
<popUpButtonCell key="cell" type="push" title="Default Browser" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="7YX-EA-9KA" id="7Ip-sU-sAK">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="XgO-Tj-QjO">
<items>
<menuItem title="Default Browser" state="on" id="7YX-EA-9KA"/>
<menuItem title="Item 2" id="gej-kA-GzQ"/>
<menuItem title="Item 3" id="zC2-cM-KDv"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lOo-NI-b07">
<rect key="frame" x="18" y="381" width="91" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Open URLs in:" id="soD-wI-YOH">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box horizontalHuggingPriority="249" borderType="line" title="New Entries" translatesAutoresizingMaskIntoConstraints="NO" id="Xvt-tP-TbR">
<rect key="frame" x="17" y="172" width="415" height="96"/>
<view key="contentView" id="g0i-00-sng">
@@ -188,28 +167,65 @@
</constraints>
</view>
</box>
<box title="URLs" translatesAutoresizingMaskIntoConstraints="NO" id="8Z8-mS-hfg">
<rect key="frame" x="17" y="380" width="415" height="78"/>
<view key="contentView" id="LD4-oH-eGw">
<rect key="frame" x="3" y="3" width="409" height="60"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lOo-NI-b07">
<rect key="frame" x="18" y="23" width="91" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Open URLs in:" id="soD-wI-YOH">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ehI-gq-lsb">
<rect key="frame" x="112" y="16" width="136" height="25"/>
<popUpButtonCell key="cell" type="push" title="Default Browser" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="7YX-EA-9KA" id="7Ip-sU-sAK">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="XgO-Tj-QjO">
<items>
<menuItem title="Default Browser" state="on" id="7YX-EA-9KA"/>
<menuItem title="Item 2" id="gej-kA-GzQ"/>
<menuItem title="Item 3" id="zC2-cM-KDv"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="ehI-gq-lsb" secondAttribute="bottom" constant="20" symbolic="YES" id="5Pa-Hu-TKL"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ehI-gq-lsb" secondAttribute="trailing" constant="20" symbolic="YES" id="8Qh-aY-FnV"/>
<constraint firstItem="ehI-gq-lsb" firstAttribute="leading" secondItem="lOo-NI-b07" secondAttribute="trailing" constant="8" symbolic="YES" id="94i-HV-mfW"/>
<constraint firstItem="lOo-NI-b07" firstAttribute="leading" secondItem="LD4-oH-eGw" secondAttribute="leading" constant="20" symbolic="YES" id="FSg-Id-v0g"/>
<constraint firstItem="lOo-NI-b07" firstAttribute="firstBaseline" secondItem="ehI-gq-lsb" secondAttribute="firstBaseline" id="I4D-aA-QaC"/>
<constraint firstItem="ehI-gq-lsb" firstAttribute="top" secondItem="LD4-oH-eGw" secondAttribute="top" constant="20" symbolic="YES" id="ciK-1U-UYJ"/>
</constraints>
</view>
</box>
</subviews>
<constraints>
<constraint firstItem="2" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="5"/>
<constraint firstAttribute="trailing" secondItem="2" secondAttribute="trailing" constant="20" symbolic="YES" id="8"/>
<constraint firstAttribute="bottom" secondItem="CLc-Vg-aWg" secondAttribute="bottom" constant="20" symbolic="YES" id="1VG-9p-VC6"/>
<constraint firstItem="Kff-Xp-hAT" firstAttribute="top" secondItem="Xvt-tP-TbR" secondAttribute="bottom" constant="8" symbolic="YES" id="3RL-tm-4wu"/>
<constraint firstAttribute="trailing" secondItem="8Z8-mS-hfg" secondAttribute="trailing" constant="20" symbolic="YES" id="5Hg-na-QAc"/>
<constraint firstItem="Xvt-tP-TbR" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="BH4-4y-uma"/>
<constraint firstItem="2" firstAttribute="top" secondItem="ehI-gq-lsb" secondAttribute="bottom" constant="8" symbolic="YES" id="CnN-aU-Qa1"/>
<constraint firstItem="Xvt-tP-TbR" firstAttribute="top" secondItem="2" secondAttribute="bottom" constant="8" symbolic="YES" id="FVK-Uf-kLv"/>
<constraint firstItem="ehI-gq-lsb" firstAttribute="leading" secondItem="lOo-NI-b07" secondAttribute="trailing" constant="8" symbolic="YES" id="KxB-TG-rH5"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ehI-gq-lsb" secondAttribute="trailing" constant="20" symbolic="YES" id="Ldw-aO-wuX"/>
<constraint firstItem="ehI-gq-lsb" firstAttribute="top" secondItem="1" secondAttribute="top" constant="20" symbolic="YES" id="MAe-l7-8k2"/>
<constraint firstItem="CLc-Vg-aWg" firstAttribute="top" secondItem="Kff-Xp-hAT" secondAttribute="bottom" constant="8" symbolic="YES" id="MZ9-vN-2za"/>
<constraint firstItem="8Z8-mS-hfg" firstAttribute="top" secondItem="1" secondAttribute="top" constant="20" symbolic="YES" id="ScX-YY-rgS"/>
<constraint firstAttribute="trailing" secondItem="Kff-Xp-hAT" secondAttribute="trailing" constant="20" symbolic="YES" id="VLC-2A-Vdd"/>
<constraint firstItem="Kff-Xp-hAT" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="Vle-Z0-mh8"/>
<constraint firstItem="2" firstAttribute="top" secondItem="8Z8-mS-hfg" secondAttribute="bottom" constant="8" symbolic="YES" id="Z6D-RB-aR5"/>
<constraint firstAttribute="trailing" secondItem="Xvt-tP-TbR" secondAttribute="trailing" constant="20" id="anU-nC-YAw"/>
<constraint firstAttribute="trailing" secondItem="CLc-Vg-aWg" secondAttribute="trailing" constant="20" symbolic="YES" id="fXu-pq-O8Q"/>
<constraint firstItem="lOo-NI-b07" firstAttribute="firstBaseline" secondItem="ehI-gq-lsb" secondAttribute="firstBaseline" id="gFK-Ce-Q3b"/>
<constraint firstItem="lOo-NI-b07" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="kaP-lB-tDY"/>
<constraint firstItem="CLc-Vg-aWg" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="wyw-aC-Vkj"/>
<constraint firstItem="8Z8-mS-hfg" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="xdM-IO-cz3"/>
</constraints>
<point key="canvasLocation" x="-906.5" y="-188.5"/>
<point key="canvasLocation" x="-906.5" y="-199.5"/>
</customView>
</objects>
</document>

View File

@@ -835,4 +835,22 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
}
}
- (NSArray<NSString *>*)_launchArgumentsForBrowserBundleID:(NSString *)bundleId {
static NSDictionary *privateBrowsingArgs;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
privateBrowsingArgs = @{ @"com.google.Chrome" : @[@"--incognito"] };
});
BOOL usePrivateBrowsing = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyUsePrivateBrowsingWhenOpeningURLs];
NSMutableArray<NSString *> *args = [[NSMutableArray alloc] init];
if(usePrivateBrowsing) {
NSArray<NSString *>* privateArgs = privateBrowsingArgs[bundleId];
if(privateBrowsingArgs) {
[args addObjectsFromArray:privateArgs];
}
}
return [args copy];
}
@end

View File

@@ -38,6 +38,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyFocusSearchAfterUnlock; // E
/* URL handling */
APPKIT_EXTERN NSString *const kMPSettingsKeyBrowserBundleId;
APPKIT_EXTERN NSString *const kMPSettingsKeyUsePrivateBrowsingWhenOpeningURLs;
/* Autolock */
APPKIT_EXTERN NSString *const kMPSettingsKeyLockOnSleep;

View File

@@ -30,6 +30,7 @@ NSString *const kMPSettingsKeyPasteboardClearTimeout = @"Cl
NSString *const kMPSettingsKeyClearPasteboardOnQuit = @"ClearClipboardOnQuit";
NSString *const kMPSettingsKeyPreventUniversalClipboard = @"PreventUniversalClipboard";
NSString *const kMPSettingsKeyBrowserBundleId = @"BrowserBundleId";
NSString *const kMPSettingsKeyUsePrivateBrowsingWhenOpeningURLs = @"UsePrivateBrowsingWhenOpeningURLs";
NSString *const kMPSettingsKeyOpenEmptyDatabaseOnLaunch = @"OpenEmptyDatabaseOnLaunch";
NSString *const kMPSettingsKeyReopenLastDatabaseOnLaunch = @"ReopenLastDatabaseOnLaunch";
NSString *const kMPSettingsKeyQuitOnLastWindowClose = @"QuitOnLastWindowClose";
@@ -176,7 +177,8 @@ NSString *const kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning = @"Au
kMPSettingsKeyFaviconDownloadMethod: @(MPFaviconDownloadMethodDirect), // Download directly from host
kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO,
kMPSettingsKeyUseUnifiedToolbar: @YES, // Do not use unified toolbar under Big Sur and above
kMPSettingsKeyFocusSearchAfterUnlock: @NO // Do not enter search directly after unlocking the database
kMPSettingsKeyFocusSearchAfterUnlock: @NO, // Do not enter search directly after unlocking the database
kMPSettingsKeyUsePrivateBrowsingWhenOpeningURLs: @NO // No private mode when option URLs by default
};
});
return standardDefaults;

View File

@@ -33,6 +33,7 @@
@property (strong) IBOutlet NSButton *generatePasswordOnEntriesCheckButton;
@property (strong) IBOutlet NSButton *hideAfterCopyToClipboardCheckButton;
@property (strong) IBOutlet NSButton *focusSearchAfterUnlockCheckButton;
//@property (strong) IBOutlet NSButton *privateBrowsingCheckButton;
- (IBAction)_showCustomBrowserSelection:(id)sender;
@@ -47,12 +48,34 @@
- (void)viewDidLoad {
NSUserDefaultsController *defaultsController = NSUserDefaultsController.sharedUserDefaultsController;
[self.doubleClickURLPopup bind:NSSelectedIndexBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickURLAction] options:nil];
[self.doubleClickTitlePopup bind:NSSelectedIndexBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickTitleAction] options:nil];
[self.updatePasswordOnTemplateEntriesCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyUpdatePasswordOnTemplateEntries] options:nil];
[self.generatePasswordOnEntriesCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyGeneratePasswordForNewEntires] options:nil];
[self.hideAfterCopyToClipboardCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyHideAfterCopyToClipboard] options:nil];
[self.focusSearchAfterUnlockCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyFocusSearchAfterUnlock] options:nil];
[self.doubleClickURLPopup bind:NSSelectedIndexBinding
toObject:defaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickURLAction]
options:nil];
[self.doubleClickTitlePopup bind:NSSelectedIndexBinding
toObject:defaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyDoubleClickTitleAction]
options:nil];
[self.updatePasswordOnTemplateEntriesCheckButton bind:NSValueBinding
toObject:defaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyUpdatePasswordOnTemplateEntries]
options:nil];
[self.generatePasswordOnEntriesCheckButton bind:NSValueBinding
toObject:defaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyGeneratePasswordForNewEntires]
options:nil];
[self.hideAfterCopyToClipboardCheckButton bind:NSValueBinding
toObject:defaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyHideAfterCopyToClipboard]
options:nil];
[self.focusSearchAfterUnlockCheckButton bind:NSValueBinding
toObject:defaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyFocusSearchAfterUnlock]
options:nil];
// [self.privateBrowsingCheckButton bind:NSValueBinding
// toObject:defaultsController
// withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyUsePrivateBrowsingWhenOpeningURLs]
// options:nil];
[self _updateBrowserSelection];
}