updated readme, small fixes

This commit is contained in:
David Wernhart 2020-02-19 11:47:55 +01:00
parent 906cec6cc5
commit da6567b5e8
12 changed files with 89 additions and 18 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -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 */,
9286FB4B23F84C2B00BEB15B /* Embed Frameworks */,
92E24B4423F847B500BE41ED /* ShellScript */,
9240BF2F23FD3547005A710B /* Embed Frameworks */,
);
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 */
@ -504,9 +521,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 = 2;
DEVELOPMENT_ASSET_PATHS = "\"AlDente/Preview Content\"";
DEVELOPMENT_TEAM = 56C2L92EKW;
ENABLE_HARDENED_RUNTIME = YES;
@ -521,7 +538,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.davidwernhart.AlDente;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -535,9 +552,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 = 2;
DEVELOPMENT_ASSET_PATHS = "\"AlDente/Preview Content\"";
DEVELOPMENT_TEAM = 56C2L92EKW;
ENABLE_HARDENED_RUNTIME = YES;
@ -552,7 +569,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = com.davidwernhart.AlDente;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -81,7 +81,15 @@ struct settings<Content: View>: View {
Spacer()
VStack(alignment: .leading){
Text("AlDente 🍝").font(.subheadline)
Text("github.com/davidwernhart/AlDente").foregroundColor(Color.blue)
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)

View File

@ -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 &quot;com.davidwernhart.Helper&quot; and anchor apple generic and certificate leaf[subject.CN] = &quot;Apple Development: david.wernhart96@gmail.com (GSDX9BQ584)&quot; 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

Binary file not shown.

BIN
Carthage/Build/.DS_Store generated vendored

Binary file not shown.

View File

@ -2,7 +2,7 @@
"Mac" : [
{
"name" : "LaunchAtLogin",
"hash" : "3aa89276b3b2caf4499607f2f8edc08acaa6b1ea55a5e9b42f7ca47c595f41d1",
"hash" : "2e9388c5a92a57f855ee3fd4af35f7bd9ca52e5b9b45da92d64104cf31cb017d",
"swiftToolchainVersion" : "5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)"
}
],

View File

@ -1 +1,45 @@
# 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.
## 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"
## 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.