Start on login - helper

This commit is contained in:
relikd
2018-10-01 23:36:17 +02:00
parent 0f90705781
commit 5fcaf97fe0
5 changed files with 213 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
#import "AppHook.h"
#import "BarMenu.h"
#import "UserPrefs.h"
#import <ServiceManagement/ServiceManagement.h>
@interface SettingsGeneral()
@@ -46,6 +47,16 @@
#pragma mark - UI interaction with IBAction
- (IBAction)changeStartOnLogin:(NSButton *)sender {
// launchctl list | grep de.relikd
CFStringRef helperIdentifier = CFBridgingRetain(@"de.relikd.baRSS-Helper");
Boolean setOnLogin = (sender.state == NSControlStateValueOn);
if (!helperIdentifier || !SMLoginItemSetEnabled(helperIdentifier, setOnLogin))
sender.state = (setOnLogin ? NSControlStateValueOff : NSControlStateValueOn); // restore prev state
if (helperIdentifier)
CFRelease(helperIdentifier);
}
- (IBAction)changeHttpApplication:(NSPopUpButton *)sender {
[UserPrefs setHttpApplication:sender.selectedItem.representedObject];
}
@@ -170,6 +181,7 @@
@return Return @c YES if operation was successfull. @c NO otherwise.
*/
- (BOOL)setDefaultRSSApplication:(NSString*)bundleID {
// TODO: Does not work with sandboxing.
CFStringRef bundleIDRef = CFBridgingRetain(bundleID);
if (!bundleIDRef)
return NO;

View File

@@ -28,6 +28,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="changeStartOnLogin:" target="-2" id="e05-eb-6ni"/>
<binding destination="iU7-KA-nY5" name="value" keyPath="values.startOnLogin" id="LnI-lN-nUf">
<dictionary key="options">
<bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/>