Skip to content

Commit

Permalink
0.1.4
Browse files Browse the repository at this point in the history
- Many improvements
  • Loading branch information
w0lfschild committed Feb 28, 2016
1 parent 78d52e1 commit 44d4859
Show file tree
Hide file tree
Showing 42 changed files with 2,235 additions and 927 deletions.
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mySIMBL

mySIMBL is the successor to the application EasySIMBL. It is designed to make managing SIMBL plugins easy and robust on OS X versions 10.9 to 10.11.
mySIMBL is a successor to the application EasySIMBL. It is designed to make managing SIMBL plugins easy and robust on OS X versions 10.9 or newer.

This appication uses the older version of SIMBL.osax (0.9.9) since EasySIMBL.osax no longer works on OS X 10.9+ and the original developer does not seem like they are going to update their application or script.

Expand All @@ -15,29 +15,22 @@ This appication uses the older version of SIMBL.osax (0.9.9) since EasySIMBL.osa

# Current Funtions

• System Integrity Protection warning
• Offers to move self to /Applications
• Drag and drop install bundles in /Library/Application Support/SIMBL/Plugins
• Open bundles with app to install in /Library/Application Support/SIMBL/Plugins
• Show bundle in Finder (Magnifying Glass)
• Toggle bundles between (Colored Circle Icon)
* Automatic updates via sparkle
* System Integrity Protection warning
* Offers to move self to /Applications
* Drag and drop install bundles in /Library/Application Support/SIMBL/Plugins
* Open bundles with app to install in /Library/Application Support/SIMBL/Plugins
* Delete bundle (Trash can)
* Show bundle in Finder (Magnifying Glass)
* Toggle bundles between (Colored Circle Icon)
⁃ /Library/Application Support/SIMBL/Plugins
⁃ /Library/Application Support/SIMBL/Plugins (Disabled)
~/Library/Application Support/SIMBL/Plugins
Bundles will display custom icon if located in <bundle>/Contents/icon.icns
* Bundles will display custom icon if located in <bundle>/Contents/icon.icns
⁃ Otherwise bundles display default bundle icon
Show bundle developer page (Globe Icon)
* Show bundle developer page (Globe Icon)
⁃ Must have url included in <bundle>/Contents/Info.plist
⁃ plist value is string 'DevURL'
Watch for changes to
* Watch for changes to
⁃ /Library/Application Support/SIMBL/Plugins
~/Library/Application Support/SIMBL/Plugins

# Goals
• Automatic updates via sparkle
• SIMBL installer
• Finish SIMBL view
• Finish preferences view
• Add discovery view
• Plugin blacklist view
• SIMBL blacklist view
~/Library/Application Support/SIMBL/Plugins
15 changes: 15 additions & 0 deletions SIMBLHelper/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// SIMBLHelper
//
// Created by Wolfgang Baird on 2/2/16.
// Copyright © 2016 Wolfgang Baird. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>


@end

152 changes: 152 additions & 0 deletions SIMBLHelper/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
//
// AppDelegate.m
// SIMBLHelper
//
// Created by Wolfgang Baird on 2/2/16.
// Copyright © 2016 Wolfgang Baird. All rights reserved.
//

@import Sparkle;
#import "AppDelegate.h"

@interface AppDelegate ()

@property (weak) IBOutlet NSWindow *window;
@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[self checkSIMBL];
[self injectPROC];
[self checkForUpdates];
}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}

- (void) runScript:(NSString*)scriptName {
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/bash"];

NSArray *arguments;
NSLog(@"shell script path: %@",scriptName);
arguments = [NSArray arrayWithObjects:scriptName, nil];
[task setArguments: arguments];

NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];

NSFileHandle *file;
file = [pipe fileHandleForReading];

[task launch];

NSData *data;
data = [file readDataToEndOfFile];

NSString *string;
string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog (@"script returned:\n%@", string);
}

- (BOOL) runProcessAsAdministrator:(NSString*)scriptPath
withArguments:(NSArray *)arguments
output:(NSString **)output
errorDescription:(NSString **)errorDescription {

NSString * allArgs = [arguments componentsJoinedByString:@" "];
NSString * fullScript = [NSString stringWithFormat:@"'%@' %@", scriptPath, allArgs];

NSDictionary *errorInfo = [NSDictionary new];
NSString *script = [NSString stringWithFormat:@"do shell script \"%@\" with administrator privileges", fullScript];

NSAppleScript *appleScript = [[NSAppleScript new] initWithSource:script];
NSAppleEventDescriptor * eventResult = [appleScript executeAndReturnError:&errorInfo];

// Check errorInfo
if (! eventResult)
{
// Describe common errors
*errorDescription = nil;
if ([errorInfo valueForKey:NSAppleScriptErrorNumber])
{
NSNumber * errorNumber = (NSNumber *)[errorInfo valueForKey:NSAppleScriptErrorNumber];
if ([errorNumber intValue] == -128)
*errorDescription = @"The administrator password is required to do this.";
}

// Set error message from provided message
if (*errorDescription == nil)
{
if ([errorInfo valueForKey:NSAppleScriptErrorMessage])
*errorDescription = (NSString *)[errorInfo valueForKey:NSAppleScriptErrorMessage];
}

return NO;
}
else
{
// Set output to the AppleScript's output
*output = [eventResult stringValue];

return YES;
}
}

- (void)checkForUpdates {
NSString *path = [[NSBundle mainBundle] bundlePath];
path = [[[path stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
NSBundle *GUIBundle = [NSBundle bundleWithPath:path];
SUUpdater *myUpdater = [SUUpdater updaterForBundle:GUIBundle];
NSDictionary *GUIDefaults = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"org.w0lf.mySIMBL"];

if (![[GUIDefaults objectForKey:@"SUHasLaunchedBefore"] boolValue])
{
[myUpdater setAutomaticallyChecksForUpdates:true];
[myUpdater setAutomaticallyDownloadsUpdates:true];
}

if ([[GUIDefaults objectForKey:@"SUEnableAutomaticChecks"] boolValue])
{
[myUpdater checkForUpdatesInBackground];
// [myUpdater setUpdateCheckInterval:86400];
}
}

- (void)checkSIMBL {
NSMutableDictionary *local = [NSMutableDictionary dictionaryWithContentsOfFile:@"/System/Library/ScriptingAdditions/SIMBL.osax/Contents/Info.plist"];
NSMutableDictionary *current = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"SIMBL.osax/Contents/Info" ofType:@"plist"]];
NSString *locVer = [local objectForKey:@"CFBundleVersion"];
NSString *curVer = [current objectForKey:@"CFBundleVersion"];

if (![locVer isEqualToString:curVer])
[self installSIMBL];
}

- (void)installSIMBL {
NSString *output = nil;
NSString *processErrorDescription = nil;
NSString *script = [[NSBundle mainBundle] pathForResource:@"SIMBL_Install" ofType:@"sh"];
// NSLog(@"%@", script);
bool success = [self runProcessAsAdministrator:script withArguments:[[NSArray alloc] init] output:&output errorDescription:&processErrorDescription];

if (!success) {
NSLog(@"Fail");
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"SIMBL install failed!"];
[alert setInformativeText:@"Something went wrong, probably System Integrity Protection."];
[alert addButtonWithTitle:@"Ok"];
NSLog(@"%ld", (long)[alert runModal]);
}
}

- (void)injectPROC {
[self runScript:[[NSBundle mainBundle] pathForResource:@"injectPROC" ofType:@"sh"]];
}

@end
58 changes: 58 additions & 0 deletions SIMBLHelper/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading

0 comments on commit 44d4859

Please sign in to comment.