Created
January 25, 2014 14:24
-
-
Save wakinchan/8617153 to your computer and use it in GitHub Desktop.
Transparent Icon Selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PreferencesFilePath [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Preferences/com.kindadev.transparenticonselection.plist"] | |
@interface SBApplicationIcon | |
- (id)applicationBundleID; | |
@end | |
@interface SBUserInstalledApplicationIcon : SBApplicationIcon | |
@end | |
%hook SBIconImageView | |
- (void)setIcon:(id)icon animated:(BOOL)animated | |
{ | |
NSString *bundleIdentifier = [(SBApplicationIcon *)icon applicationBundleID]; | |
BOOL isDisableApplication = NO; | |
if (bundleIdentifier | |
&& ([NSStringFromClass([icon class]) isEqualToString:@"SBUserInstalledApplicationIcon"] | |
|| [NSStringFromClass([icon class]) isEqualToString:@"SBApplicationIcon"])) { | |
NSDictionary *udDict = [NSDictionary dictionaryWithContentsOfFile:PreferencesFilePath]; | |
NSString *key = [@"TISDisable-" stringByAppendingString:bundleIdentifier]; | |
id disablePref = [udDict objectForKey:key]; | |
isDisableApplication = disablePref ? [disablePref boolValue] : NO; | |
} | |
if (isDisableApplication) %orig(nil, animated); | |
else %orig; | |
} | |
- (id)darkeningOverlayImage | |
{ | |
BOOL isDarkeningOverlayImage; | |
NSDictionary *udDict = [NSDictionary dictionaryWithContentsOfFile:PreferencesFilePath]; | |
id darkeningPref = [udDict objectForKey:@"isDarkeningOverlayImage"]; | |
isDarkeningOverlayImage = darkeningPref ? [darkeningPref boolValue] : NO; | |
if (isDarkeningOverlayImage) return nil; | |
else return %orig; | |
} | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment