mirror of
https://github.com/AppHouseKitchen/AlDente-Battery_Care_and_Monitoring.git
synced 2026-02-16 04:57:42 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3822013707 | ||
|
|
ffdf09b135 | ||
|
|
1997e87a9a | ||
|
|
5185014922 | ||
|
|
ad63ea3336 | ||
|
|
da6567b5e8 |
@@ -8,11 +8,12 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
9224A08723F1F70600961AC4 /* com.davidwernhart.Helper in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9283741823F1F34400B8AE7A /* com.davidwernhart.Helper */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
9240BF2C23FD34E2005A710B /* LaunchAtLogin.framework.dSYM in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9240BF2B23FD34E2005A710B /* LaunchAtLogin.framework.dSYM */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
9240BF2D23FD3547005A710B /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9286FB4823F84C2B00BEB15B /* LaunchAtLogin.framework */; };
|
||||
9240BF2E23FD3547005A710B /* LaunchAtLogin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9286FB4823F84C2B00BEB15B /* LaunchAtLogin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
927DBFC923F5478E00F8BF0D /* HelperToolProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927DBFC823F5478E00F8BF0D /* HelperToolProtocol.swift */; };
|
||||
927DBFCA23F5478E00F8BF0D /* HelperToolProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927DBFC823F5478E00F8BF0D /* HelperToolProtocol.swift */; };
|
||||
9283741B23F1F34400B8AE7A /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9283741A23F1F34400B8AE7A /* main.swift */; };
|
||||
9286FB4923F84C2B00BEB15B /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9286FB4823F84C2B00BEB15B /* LaunchAtLogin.framework */; };
|
||||
9286FB4A23F84C2B00BEB15B /* LaunchAtLogin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9286FB4823F84C2B00BEB15B /* LaunchAtLogin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
92981EDB23F08D9B00C05424 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92981EDA23F08D9B00C05424 /* AppDelegate.swift */; };
|
||||
92981EDD23F08D9B00C05424 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92981EDC23F08D9B00C05424 /* ContentView.swift */; };
|
||||
92981EDF23F08D9C00C05424 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92981EDE23F08D9C00C05424 /* Assets.xcassets */; };
|
||||
@@ -34,6 +35,17 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9240BF2F23FD3547005A710B /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
9240BF2E23FD3547005A710B /* LaunchAtLogin.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9258163B23F5CBD500AB7387 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -57,9 +69,9 @@
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
9286FB4A23F84C2B00BEB15B /* LaunchAtLogin.framework in Embed Frameworks */,
|
||||
9240BF2C23FD34E2005A710B /* LaunchAtLogin.framework.dSYM in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -67,6 +79,8 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
9240BF2923FD3257005A710B /* LaunchAtLogin.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = LaunchAtLogin.framework.dSYM; path = Carthage/Build/Mac/LaunchAtLogin.framework.dSYM; sourceTree = "<group>"; };
|
||||
9240BF2B23FD34E2005A710B /* LaunchAtLogin.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = LaunchAtLogin.framework.dSYM; path = Carthage/Build/Mac/LaunchAtLogin.framework.dSYM; sourceTree = "<group>"; };
|
||||
927DBFC623F533FB00F8BF0D /* Helper-Launchd.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Helper-Launchd.plist"; sourceTree = "<group>"; };
|
||||
927DBFC823F5478E00F8BF0D /* HelperToolProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperToolProtocol.swift; sourceTree = "<group>"; };
|
||||
927DBFCB23F54C2C00F8BF0D /* HelperTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperTool.swift; sourceTree = "<group>"; };
|
||||
@@ -98,7 +112,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9286FB4923F84C2B00BEB15B /* LaunchAtLogin.framework in Frameworks */,
|
||||
9240BF2D23FD3547005A710B /* LaunchAtLogin.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -136,6 +150,8 @@
|
||||
92981ECE23F08D9B00C05424 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9240BF2923FD3257005A710B /* LaunchAtLogin.framework.dSYM */,
|
||||
9240BF2B23FD34E2005A710B /* LaunchAtLogin.framework.dSYM */,
|
||||
927DBFC723F545AF00F8BF0D /* Common */,
|
||||
92981ED923F08D9B00C05424 /* AlDente */,
|
||||
9283741923F1F34400B8AE7A /* com.davidwernhart.Helper */,
|
||||
@@ -205,8 +221,9 @@
|
||||
92981ED423F08D9B00C05424 /* Frameworks */,
|
||||
92981ED523F08D9B00C05424 /* Resources */,
|
||||
9224A08623F1F6E300961AC4 /* CopyFiles */,
|
||||
92E24B4423F847B500BE41ED /* ShellScript */,
|
||||
9240BF2F23FD3547005A710B /* Embed Frameworks */,
|
||||
9286FB4B23F84C2B00BEB15B /* Embed Frameworks */,
|
||||
92E24B4423F847B500BE41ED /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -283,7 +300,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh\n";
|
||||
shellScript = "exec \"${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
@@ -350,6 +367,7 @@
|
||||
PRODUCT_MODULE_NAME = AlDenteHelper;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Frameworks";
|
||||
};
|
||||
@@ -380,6 +398,7 @@
|
||||
PRODUCT_MODULE_NAME = AlDenteHelper;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/Frameworks";
|
||||
};
|
||||
@@ -440,6 +459,7 @@
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = NO;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
@@ -493,6 +513,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = NO;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
@@ -504,9 +525,9 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = AlDente/AlDente.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
CURRENT_PROJECT_VERSION = 4;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"AlDente/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 56C2L92EKW;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@@ -521,10 +542,11 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.davidwernhart.AlDente;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -535,9 +557,9 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = AlDente/AlDente.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
CURRENT_PROJECT_VERSION = 4;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"AlDente/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 56C2L92EKW;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@@ -552,10 +574,11 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.davidwernhart.AlDente;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SKIP_INSTALL = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
Binary file not shown.
BIN
AlDente/.DS_Store
vendored
BIN
AlDente/.DS_Store
vendored
Binary file not shown.
@@ -10,6 +10,7 @@ import Cocoa
|
||||
import SwiftUI
|
||||
import ServiceManagement
|
||||
import Foundation
|
||||
import LaunchAtLogin
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@@ -33,14 +34,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
let statusBar = NSStatusBar.system
|
||||
statusBarItem = statusBar.statusItem(
|
||||
withLength: NSStatusItem.squareLength)
|
||||
statusBarItem.button?.title = "🍝"
|
||||
statusBarItem.button?.image = NSImage(named: "menubaricon")!
|
||||
//statusBarItem.button?.title = "🍝"
|
||||
|
||||
if let button = self.statusBarItem.button {
|
||||
button.action = #selector(togglePopover(_:))
|
||||
}
|
||||
|
||||
Helper.instance.checkHelperVersion()
|
||||
|
||||
|
||||
LaunchAtLogin.isEnabled = true
|
||||
}
|
||||
|
||||
@objc func togglePopover(_ sender: AnyObject?) {
|
||||
|
||||
54
AlDente/Assets.xcassets/menubaricon.imageset/Contents.json
vendored
Normal file
54
AlDente/Assets.xcassets/menubaricon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "aldentelighticon1x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"filename" : "aldentedarkicon1x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "aldentelighticon2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"filename" : "aldentedarkicon2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon1x.png
vendored
Normal file
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon1x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon2x.png
vendored
Normal file
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon1x.png
vendored
Normal file
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon1x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon2x.png
vendored
Normal file
BIN
AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -32,11 +32,16 @@ struct RedButtonStyle: ButtonStyle {
|
||||
}
|
||||
}
|
||||
|
||||
var osxScale:Bool = true
|
||||
|
||||
struct settings<Content: View>: View {
|
||||
|
||||
|
||||
var content: () -> Content
|
||||
@State var launchOnLogin = LaunchAtLogin.isEnabled
|
||||
@State var osxScaleToggle = osxScale
|
||||
@ObservedObject var presenter = SMCPresenter.shared
|
||||
|
||||
|
||||
init(@ViewBuilder _ content: @escaping () -> Content) {
|
||||
self.content = content
|
||||
@@ -66,6 +71,19 @@ struct settings<Content: View>: View {
|
||||
Text("Launch on Login")
|
||||
}.padding()
|
||||
|
||||
Toggle(isOn: Binding(
|
||||
get: {
|
||||
self.osxScaleToggle
|
||||
},
|
||||
set: {(newValue) in
|
||||
self.osxScaleToggle = newValue
|
||||
osxScale = newValue
|
||||
self.presenter.setValue(value: Float(self.presenter.value))
|
||||
}
|
||||
)) {
|
||||
Text("Use MacOS battery scale")
|
||||
}.padding()
|
||||
|
||||
Spacer()
|
||||
Button( action: {
|
||||
Helper.instance.installHelper()
|
||||
@@ -80,8 +98,16 @@ struct settings<Content: View>: View {
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
VStack(alignment: .leading){
|
||||
Text("AlDente 🍝").font(.subheadline)
|
||||
Text("github.com/davidwernhart/AlDente").foregroundColor(Color.blue)
|
||||
Text("AlDente 1.2 🍝").font(.subheadline)
|
||||
Button(action:{
|
||||
let url = URL(string: "https://www.github.com/davidwernhart/AlDente")!
|
||||
if NSWorkspace.shared.open(url) {
|
||||
print("default browser was successfully opened")
|
||||
}
|
||||
}){
|
||||
Text("github.com/davidwernhart/AlDente").foregroundColor(Color.blue)
|
||||
}.buttonStyle(PlainButtonStyle())
|
||||
|
||||
Text("Created with 🤍 by David Wernhart in 2020")
|
||||
// Text("AlDente 🍝").font(.title)
|
||||
// Text("Keep your battery just right").font(.subheadline)
|
||||
@@ -106,7 +132,7 @@ struct ContentView: View{
|
||||
@State var adaptableHeight = CGFloat(100)
|
||||
@State var showSettings = false
|
||||
|
||||
@ObservedObject var presenter = SMCPresenter()
|
||||
@ObservedObject var presenter = SMCPresenter.shared
|
||||
|
||||
init() {
|
||||
Helper.instance.delegate = presenter
|
||||
@@ -174,7 +200,8 @@ struct ContentView: View{
|
||||
|
||||
Spacer()
|
||||
if(self.showSettings){
|
||||
settings{Text("")}
|
||||
//settings{Text("")}
|
||||
settings({Text("")})
|
||||
}
|
||||
|
||||
}.frame(width: 400, height: adaptableHeight)
|
||||
@@ -187,12 +214,19 @@ struct ContentView: View{
|
||||
|
||||
class SMCPresenter: ObservableObject, HelperDelegate{
|
||||
|
||||
static let shared = SMCPresenter()
|
||||
|
||||
@Published var value: UInt8 = 0
|
||||
private var timer: Timer?
|
||||
|
||||
func OnMaxBatRead(value: UInt8){
|
||||
DispatchQueue.main.async {
|
||||
self.value = value
|
||||
if(osxScale){
|
||||
self.value = value + 3
|
||||
}
|
||||
else{
|
||||
self.value = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,11 +235,19 @@ class SMCPresenter: ObservableObject, HelperDelegate{
|
||||
self.value = UInt8(value)
|
||||
}
|
||||
self.timer?.invalidate()
|
||||
|
||||
self.timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false, block: { timer in
|
||||
print("Setting Max Battery To: ",value)
|
||||
Helper.instance.writeMaxBatteryCharge(setVal: UInt8(value))
|
||||
Helper.instance.readMaxBatteryCharge()
|
||||
self.timer = nil
|
||||
var setval = value
|
||||
if(osxScale){
|
||||
setval -= 3
|
||||
}
|
||||
if(setval >= 20 && setval <= 100){
|
||||
print("Setting Max Battery To: ",setval)
|
||||
Helper.instance.writeMaxBatteryCharge(setVal: UInt8(setval))
|
||||
Helper.instance.readMaxBatteryCharge()
|
||||
self.timer = nil
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>LSUIElement</key>
|
||||
<false/>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2020 David Wernhart. All rights reserved.</string>
|
||||
<key>NSMainStoryboardFile</key>
|
||||
@@ -37,7 +39,7 @@
|
||||
<key>SMPrivilegedExecutables</key>
|
||||
<dict>
|
||||
<key>com.davidwernhart.Helper</key>
|
||||
<string>identifier "com.davidwernhart.Helper" and anchor apple generic and certificate leaf[subject.CN] = "Apple Development: david.wernhart96@gmail.com (GSDX9BQ584)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
|
||||
<string>identifier "com.davidwernhart.Helper" and anchor apple generic and certificate leaf[subject.CN] = "Apple Development: david.wernhart96@gmail.com (GSDX9BQ584)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
BIN
Carthage/.DS_Store
vendored
BIN
Carthage/.DS_Store
vendored
Binary file not shown.
BIN
Carthage/Build/.DS_Store
generated
vendored
BIN
Carthage/Build/.DS_Store
generated
vendored
Binary file not shown.
15
Carthage/Build/.LaunchAtLogin.version
generated
vendored
15
Carthage/Build/.LaunchAtLogin.version
generated
vendored
@@ -1,19 +1,10 @@
|
||||
{
|
||||
"commitish" : "v3.0.0",
|
||||
"Mac" : [
|
||||
{
|
||||
"name" : "LaunchAtLogin",
|
||||
"hash" : "3aa89276b3b2caf4499607f2f8edc08acaa6b1ea55a5e9b42f7ca47c595f41d1",
|
||||
"swiftToolchainVersion" : "5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)"
|
||||
"hash" : "3e5f8a12d3371e2e67b1cb69491ac112af892603ed2ceb6af78d9727577f3371",
|
||||
"swiftToolchainVersion" : "5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)"
|
||||
}
|
||||
],
|
||||
"watchOS" : [
|
||||
|
||||
],
|
||||
"tvOS" : [
|
||||
|
||||
],
|
||||
"commitish" : "v3.0.0",
|
||||
"iOS" : [
|
||||
|
||||
]
|
||||
}
|
||||
BIN
Carthage/Build/Mac/LaunchAtLogin.framework.dSYM/Contents/Resources/DWARF/LaunchAtLogin
generated
vendored
BIN
Carthage/Build/Mac/LaunchAtLogin.framework.dSYM/Contents/Resources/DWARF/LaunchAtLogin
generated
vendored
Binary file not shown.
7
Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Headers/LaunchAtLogin-Swift.h
generated
vendored
7
Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Headers/LaunchAtLogin-Swift.h
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// Generated by Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
|
||||
// Generated by Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
@@ -82,6 +82,11 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
#else
|
||||
# define SWIFT_NOESCAPE
|
||||
#endif
|
||||
#if __has_attribute(ns_consumed)
|
||||
# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
|
||||
#else
|
||||
# define SWIFT_RELEASES_ARGUMENT
|
||||
#endif
|
||||
#if __has_attribute(warn_unused_result)
|
||||
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
|
||||
BIN
Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/LaunchAtLogin
generated
vendored
BIN
Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/LaunchAtLogin
generated
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10
Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/Info.plist
generated
vendored
10
Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/Info.plist
generated
vendored
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>19D76</string>
|
||||
<string>19F101</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>LaunchAtLogin</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -25,17 +25,17 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>11C504</string>
|
||||
<string>11E608c</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>19B90</string>
|
||||
<string>19E258</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.15</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1130</string>
|
||||
<string>1150</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>11C504</string>
|
||||
<string>11E608c</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.12</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>19D76</string>
|
||||
<string>19F101</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>LaunchAtLoginHelper</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -25,17 +25,17 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>11C504</string>
|
||||
<string>11E608c</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>19B90</string>
|
||||
<string>19E258</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.15</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1130</string>
|
||||
<string>1150</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>11C504</string>
|
||||
<string>11E608c</string>
|
||||
<key>LSBackgroundOnly</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
Binary file not shown.
49
README.md
49
README.md
@@ -1 +1,48 @@
|
||||
# AlDente
|
||||
# AlDente 🍝
|
||||
_MacOS menu bar tool to limit maximum charging percentage_
|
||||
|
||||
#### Don't overcook your battery! Keep it fresh and chewy with AlDente.
|
||||
|
||||
## Why do I need this?
|
||||
Li-ion and polymer batteries (like the one in your MacBook) last the longest when operating between 30 and 80 percent. Keeping your battery at 100% at all times can shorten the lifespan of your notebook significantly.
|
||||
More information can be found here:
|
||||
<https://batteryuniversity.com/learn/article/how_to_charge_when_to_charge_table>
|
||||
|
||||
## How does it work?
|
||||
The tool writes the desired value to your MacBooks SMC (System Management Controller), which handles the rest.
|
||||
For everyone that is curious, the modified SMC key is called "BCLM" (Presumably "Battery Charge Level Max")
|
||||
|
||||
## AlDente is tested and working on:
|
||||
* 2019 MacBook Pro 16"
|
||||
* 2017 Macbook Pro 13" without TouchBar
|
||||
* 2017 MacBook Air 13"
|
||||
* 2013 MacBook Pro 13"
|
||||
|
||||
|
||||
## Download:
|
||||
<https://github.com/davidwernhart/AlDente/releases>
|
||||
|
||||
## How to use:
|
||||
Simply open AlDente_Installer.dmg and drag the App to your Applications Folder.
|
||||
On the first start, the application is going to ask you to allow installing a helper tool. This is necessary, since writing SMC Keys requires root privileges.
|
||||
Once finished, enter your desired max. charging percentage by clicking on the 🍝 icon on your
|
||||
menu bar.
|
||||
|
||||
For some reason, MacOS will always try to squeeze in a few more percent than specified by the SMC. For example, if you set yours to 80% it will stop charging at around 83%, so be patient. Strangely, this is not the case using Windows with bootcamp, therefore I have chosen not to correct this inaccuracy in code for now.
|
||||
|
||||
Usually, the operating system will take a minute or two registering the changes, so be patient. You can check if it's working by setting the max. percentage to e.g.: 70%. After a while, clicking on your battery icon will report "Battery is not charging" if you have more than ≈73% left, even tough your charger is connected. Notice that in this state, your MacBook is still powered by the charger, but the battery is not charging anymore.
|
||||
|
||||
## Other tools I used in this project:
|
||||
* <https://github.com/beltex/SMCKit>
|
||||
* <https://github.com/sindresorhus/LaunchAtLogin>
|
||||
* <https://github.com/andreyvit/create-dmg>
|
||||
|
||||
## Disclaimer:
|
||||
I do not take any responsibility for any sort of damage in result of using this tool! Alltough this had no negative side effects for me, AlDente still taps in some very low level system functions that are not ment to be tampered with. Use it at your own risk!
|
||||
|
||||
Copyright(c) 2020 David Wernhart
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Reference in New Issue
Block a user