mirror of
https://github.com/hholtmann/smcFanControl.git
synced 2025-11-04 19:49:16 +01:00
Started support for dark mode
This commit is contained in:
@ -100,8 +100,9 @@ NSUserDefaults *defaults;
|
|||||||
[pw registerForSleepWakeNotification];
|
[pw registerForSleepWakeNotification];
|
||||||
[pw registerForPowerChange];
|
[pw registerForPowerChange];
|
||||||
|
|
||||||
//load defaults
|
|
||||||
|
|
||||||
|
//load defaults
|
||||||
|
|
||||||
[DefaultsController setAppliesImmediately:NO];
|
[DefaultsController setAppliesImmediately:NO];
|
||||||
|
|
||||||
mdefaults=[[MachineDefaults alloc] init:nil];
|
mdefaults=[[MachineDefaults alloc] init:nil];
|
||||||
@ -131,7 +132,7 @@ NSUserDefaults *defaults;
|
|||||||
|
|
||||||
//sync option for Macbook Pro's
|
//sync option for Macbook Pro's
|
||||||
NSRange range_mbp=[[MachineDefaults computerModel] rangeOfString:@"MacBookPro"];
|
NSRange range_mbp=[[MachineDefaults computerModel] rangeOfString:@"MacBookPro"];
|
||||||
if (range_mbp.length>0) {
|
if (range_mbp.length>0 && [[s_sed objectForKey:@"Fans"] count] == 2) {
|
||||||
[sync setHidden:NO];
|
[sync setHidden:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,8 +212,12 @@ NSUserDefaults *defaults;
|
|||||||
[self changeMenu:nil];
|
[self changeMenu:nil];
|
||||||
|
|
||||||
//seting toolbar image
|
//seting toolbar image
|
||||||
menu_image=[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"smc" ofType:@"png"]];
|
menu_image = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"smc" ofType:@"png"]];
|
||||||
menu_image_alt=[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"smcover" ofType:@"png"]];
|
menu_image_alt = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"smcover" ofType:@"png"]];
|
||||||
|
if ([menu_image respondsToSelector:@selector(setTemplate:)]) {
|
||||||
|
[menu_image setTemplate:YES];
|
||||||
|
[menu_image_alt setTemplate:YES];
|
||||||
|
}
|
||||||
|
|
||||||
//release MachineDefaults class first call
|
//release MachineDefaults class first call
|
||||||
//add timer for reading to RunLoop
|
//add timer for reading to RunLoop
|
||||||
@ -233,9 +238,14 @@ NSUserDefaults *defaults;
|
|||||||
-(void)init_statusitem{
|
-(void)init_statusitem{
|
||||||
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength: NSVariableStatusItemLength] retain];
|
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength: NSVariableStatusItemLength] retain];
|
||||||
[statusItem setMenu: theMenu];
|
[statusItem setMenu: theMenu];
|
||||||
[statusItem setEnabled: YES];
|
|
||||||
[statusItem setHighlightMode:YES];
|
if ([statusItem respondsToSelector:@selector(button)]) {
|
||||||
[statusItem setTitle:@"smc..."];
|
[statusItem.button setTitle:@"smc..."];
|
||||||
|
} else {
|
||||||
|
[statusItem setEnabled: YES];
|
||||||
|
[statusItem setHighlightMode:YES];
|
||||||
|
[statusItem setTitle:@"smc..."];
|
||||||
|
}
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<[s_menus count];i++) {
|
for(i=0;i<[s_menus count];i++) {
|
||||||
[theMenu insertItem:[s_menus objectAtIndex:i] atIndex:i];
|
[theMenu insertItem:[s_menus objectAtIndex:i] atIndex:i];
|
||||||
@ -312,9 +322,10 @@ NSUserDefaults *defaults;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Called via a timer mechanism. This is where all the temp / RPM reading is done.
|
// Called via a timer mechanism. This is where all the temp / RPM reading is done.
|
||||||
//reads fan data and updates the gui
|
//reads fan data and updates the gui
|
||||||
-(void) readFanData:(NSTimer*)timer{
|
-(void) readFanData:(id)caller{
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@ -391,6 +402,11 @@ NSUserDefaults *defaults;
|
|||||||
NSMutableAttributedString *s_status = nil;
|
NSMutableAttributedString *s_status = nil;
|
||||||
NSMutableParagraphStyle *paragraphStyle = nil;
|
NSMutableParagraphStyle *paragraphStyle = nil;
|
||||||
|
|
||||||
|
NSColor *menuColor = (NSColor*)[NSUnarchiver unarchiveObjectWithData:[defaults objectForKey:@"MenuColor"]];
|
||||||
|
BOOL setColor = NO;
|
||||||
|
if (!([[menuColor colorUsingColorSpaceName:
|
||||||
|
NSCalibratedWhiteColorSpace] whiteComponent] == 0.0) || ![statusItem respondsToSelector:@selector(button)]) setColor = YES;
|
||||||
|
|
||||||
switch (menuBarSetting) {
|
switch (menuBarSetting) {
|
||||||
default:
|
default:
|
||||||
case 1: {
|
case 1: {
|
||||||
@ -411,10 +427,18 @@ NSUserDefaults *defaults;
|
|||||||
[paragraphStyle setAlignment:NSLeftTextAlignment];
|
[paragraphStyle setAlignment:NSLeftTextAlignment];
|
||||||
[s_status addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Lucida Grande" size:fsize] range:NSMakeRange(0,[s_status length])];
|
[s_status addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Lucida Grande" size:fsize] range:NSMakeRange(0,[s_status length])];
|
||||||
[s_status addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[s_status length])];
|
[s_status addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[s_status length])];
|
||||||
[s_status addAttribute:NSForegroundColorAttributeName value:(NSColor*)[NSUnarchiver unarchiveObjectWithData:[defaults objectForKey:@"MenuColor"]] range:NSMakeRange(0,[s_status length])];
|
|
||||||
[statusItem setAttributedTitle:s_status];
|
if (setColor) [s_status addAttribute:NSForegroundColorAttributeName value:menuColor range:NSMakeRange(0,[s_status length])];
|
||||||
[statusItem setImage:nil];
|
|
||||||
[statusItem setAlternateImage:nil];
|
if ([statusItem respondsToSelector:@selector(button)]) {
|
||||||
|
[statusItem.button setAttributedTitle:s_status];
|
||||||
|
[statusItem.button setImage:nil];
|
||||||
|
[statusItem.button setAlternateImage:nil];
|
||||||
|
} else {
|
||||||
|
[statusItem setAttributedTitle:s_status];
|
||||||
|
[statusItem setImage:nil];
|
||||||
|
[statusItem setAlternateImage:nil];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,30 +446,49 @@ NSUserDefaults *defaults;
|
|||||||
// TODO: Big waste of energy to update this tooltip every X seconds when the user
|
// TODO: Big waste of energy to update this tooltip every X seconds when the user
|
||||||
// is unlikely to hover the smcFanControl icon over and over again.
|
// is unlikely to hover the smcFanControl icon over and over again.
|
||||||
[statusItem setLength:26];
|
[statusItem setLength:26];
|
||||||
[statusItem setTitle:nil];
|
if ([statusItem respondsToSelector:@selector(button)]) {
|
||||||
[statusItem setToolTip:[NSString stringWithFormat:@"%@\n%@",temp,fan]];
|
[statusItem.button setTitle:nil];
|
||||||
[statusItem setImage:menu_image];
|
[statusItem.button setToolTip:[NSString stringWithFormat:@"%@\n%@",temp,fan]];
|
||||||
[statusItem setAlternateImage:menu_image_alt];
|
[statusItem.button setImage:menu_image];
|
||||||
|
[statusItem.button setAlternateImage:menu_image_alt];
|
||||||
|
} else {
|
||||||
|
[statusItem setTitle:nil];
|
||||||
|
[statusItem setToolTip:[NSString stringWithFormat:@"%@\n%@",temp,fan]];
|
||||||
|
[statusItem setImage:menu_image];
|
||||||
|
[statusItem setAlternateImage:menu_image_alt];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
[statusItem setLength:46];
|
[statusItem setLength:46];
|
||||||
s_status=[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",temp]];
|
s_status=[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",temp]];
|
||||||
[s_status addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Lucida Grande" size:12] range:NSMakeRange(0,[s_status length])];
|
[s_status addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Lucida Grande" size:12] range:NSMakeRange(0,[s_status length])];
|
||||||
[s_status addAttribute:NSForegroundColorAttributeName value:(NSColor*)[NSUnarchiver unarchiveObjectWithData:[defaults objectForKey:@"MenuColor"]] range:NSMakeRange(0,[s_status length])];
|
if (setColor) [s_status addAttribute:NSForegroundColorAttributeName value:menuColor range:NSMakeRange(0,[s_status length])];
|
||||||
[statusItem setAttributedTitle:s_status];
|
if ([statusItem respondsToSelector:@selector(button)]) {
|
||||||
[statusItem setImage:nil];
|
[statusItem.button setAttributedTitle:s_status];
|
||||||
[statusItem setAlternateImage:nil];
|
[statusItem.button setImage:nil];
|
||||||
|
[statusItem.button setAlternateImage:nil];
|
||||||
|
} else {
|
||||||
|
[statusItem setAttributedTitle:s_status];
|
||||||
|
[statusItem setImage:nil];
|
||||||
|
[statusItem setAlternateImage:nil];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
[statusItem setLength:65];
|
[statusItem setLength:65];
|
||||||
s_status=[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",fan]];
|
s_status=[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",fan]];
|
||||||
[s_status addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Lucida Grande" size:12] range:NSMakeRange(0,[s_status length])];
|
[s_status addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Lucida Grande" size:12] range:NSMakeRange(0,[s_status length])];
|
||||||
[s_status addAttribute:NSForegroundColorAttributeName value:(NSColor*)[NSUnarchiver unarchiveObjectWithData:[defaults objectForKey:@"MenuColor"]] range:NSMakeRange(0,[s_status length])];
|
if (setColor) [s_status addAttribute:NSForegroundColorAttributeName value:menuColor range:NSMakeRange(0,[s_status length])];
|
||||||
[statusItem setAttributedTitle:s_status];
|
if ([statusItem respondsToSelector:@selector(button)]) {
|
||||||
[statusItem setImage:nil];
|
[statusItem.button setAttributedTitle:s_status];
|
||||||
[statusItem setAlternateImage:nil];
|
[statusItem.button setImage:nil];
|
||||||
|
[statusItem.button setAlternateImage:nil];
|
||||||
|
} else {
|
||||||
|
[statusItem setAttributedTitle:s_status];
|
||||||
|
[statusItem setImage:nil];
|
||||||
|
[statusItem setAlternateImage:nil];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -306,9 +306,6 @@
|
|||||||
8924ECED15AC96E70031730C = {
|
8924ECED15AC96E70031730C = {
|
||||||
DevelopmentTeam = MC98392EJC;
|
DevelopmentTeam = MC98392EJC;
|
||||||
};
|
};
|
||||||
8D1107260486CEB800E47090 = {
|
|
||||||
DevelopmentTeam = MC98392EJC;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "smcFanControl" */;
|
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "smcFanControl" */;
|
||||||
@ -433,8 +430,8 @@
|
|||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application: Hendrik Holtmann";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
@ -460,8 +457,8 @@
|
|||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
|
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application: Hendrik Holtmann";
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
@ -481,7 +478,7 @@
|
|||||||
C01FCF4B08A954540054247B /* Debug */ = {
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "Mac Developer: Yancheng Zheng (5FNT3EVMK3)";
|
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -514,7 +511,7 @@
|
|||||||
C01FCF4C08A954540054247B /* Release */ = {
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "Mac Developer: Yancheng Zheng (5FNT3EVMK3)";
|
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@ -546,6 +543,7 @@
|
|||||||
C01FCF4F08A954540054247B /* Debug */ = {
|
C01FCF4F08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||||
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
@ -561,6 +559,7 @@
|
|||||||
C01FCF5008A954540054247B /* Release */ = {
|
C01FCF5008A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||||
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
|||||||
@ -10,29 +10,29 @@
|
|||||||
<string>smcFanControl</string>
|
<string>smcFanControl</string>
|
||||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>873C5522-1316-4367-B29F-BE94D7522D13</key>
|
<key>4B1FAC2C01D9B3B4FE6C32B0274DA6C3D41C10ED</key>
|
||||||
<string>https://github.com/hholtmann/smcFanControl.git</string>
|
<string>https://github.com/hholtmann/smcFanControl.git</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IDESourceControlProjectPath</key>
|
<key>IDESourceControlProjectPath</key>
|
||||||
<string>smcFanControl.xcodeproj/project.xcworkspace</string>
|
<string>smcFanControl.xcodeproj</string>
|
||||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>873C5522-1316-4367-B29F-BE94D7522D13</key>
|
<key>4B1FAC2C01D9B3B4FE6C32B0274DA6C3D41C10ED</key>
|
||||||
<string>../..</string>
|
<string>../..</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IDESourceControlProjectURL</key>
|
<key>IDESourceControlProjectURL</key>
|
||||||
<string>https://github.com/hholtmann/smcFanControl.git</string>
|
<string>https://github.com/hholtmann/smcFanControl.git</string>
|
||||||
<key>IDESourceControlProjectVersion</key>
|
<key>IDESourceControlProjectVersion</key>
|
||||||
<integer>110</integer>
|
<integer>111</integer>
|
||||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||||
<string>873C5522-1316-4367-B29F-BE94D7522D13</string>
|
<string>4B1FAC2C01D9B3B4FE6C32B0274DA6C3D41C10ED</string>
|
||||||
<key>IDESourceControlProjectWCConfigurations</key>
|
<key>IDESourceControlProjectWCConfigurations</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||||
<string>public.vcs.git</string>
|
<string>public.vcs.git</string>
|
||||||
<key>IDESourceControlWCCIdentifierKey</key>
|
<key>IDESourceControlWCCIdentifierKey</key>
|
||||||
<string>873C5522-1316-4367-B29F-BE94D7522D13</string>
|
<string>4B1FAC2C01D9B3B4FE6C32B0274DA6C3D41C10ED</string>
|
||||||
<key>IDESourceControlWCCName</key>
|
<key>IDESourceControlWCCName</key>
|
||||||
<string>smcFanControl</string>
|
<string>smcFanControl</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Binary file not shown.
@ -44,7 +44,7 @@
|
|||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Debug"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
|
|||||||
Reference in New Issue
Block a user