diff --git a/.DS_Store b/.DS_Store index 9e82716..4c90f9d 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/AlDente.xcodeproj/project.pbxproj b/AlDente.xcodeproj/project.pbxproj index 247f03a..734d408 100644 --- a/AlDente.xcodeproj/project.pbxproj +++ b/AlDente.xcodeproj/project.pbxproj @@ -221,9 +221,9 @@ 92981ED423F08D9B00C05424 /* Frameworks */, 92981ED523F08D9B00C05424 /* Resources */, 9224A08623F1F6E300961AC4 /* CopyFiles */, + 9240BF2F23FD3547005A710B /* Embed Frameworks */, 9286FB4B23F84C2B00BEB15B /* Embed Frameworks */, 92E24B4423F847B500BE41ED /* ShellScript */, - 9240BF2F23FD3547005A710B /* Embed Frameworks */, ); buildRules = ( ); @@ -367,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"; }; @@ -397,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"; }; @@ -457,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"; }; @@ -510,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"; }; @@ -523,7 +527,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = "\"AlDente/Preview Content\""; DEVELOPMENT_TEAM = 56C2L92EKW; ENABLE_HARDENED_RUNTIME = YES; @@ -538,10 +542,11 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.1; + 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; @@ -554,7 +559,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_ASSET_PATHS = "\"AlDente/Preview Content\""; DEVELOPMENT_TEAM = 56C2L92EKW; ENABLE_HARDENED_RUNTIME = YES; @@ -569,10 +574,11 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.1; + 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; diff --git a/AlDente.xcodeproj/project.xcworkspace/xcuserdata/davidwernhart.xcuserdatad/UserInterfaceState.xcuserstate b/AlDente.xcodeproj/project.xcworkspace/xcuserdata/davidwernhart.xcuserdatad/UserInterfaceState.xcuserstate index 2ca9437..c06b72a 100644 Binary files a/AlDente.xcodeproj/project.xcworkspace/xcuserdata/davidwernhart.xcuserdatad/UserInterfaceState.xcuserstate and b/AlDente.xcodeproj/project.xcworkspace/xcuserdata/davidwernhart.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/AlDente/.DS_Store b/AlDente/.DS_Store index 8a5ef45..ae57097 100644 Binary files a/AlDente/.DS_Store and b/AlDente/.DS_Store differ diff --git a/AlDente/AppDelegate.swift b/AlDente/AppDelegate.swift index 4b244a8..b1d5c7f 100644 --- a/AlDente/AppDelegate.swift +++ b/AlDente/AppDelegate.swift @@ -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?) { diff --git a/AlDente/Assets.xcassets/menubaricon.imageset/Contents.json b/AlDente/Assets.xcassets/menubaricon.imageset/Contents.json new file mode 100644 index 0000000..401a362 --- /dev/null +++ b/AlDente/Assets.xcassets/menubaricon.imageset/Contents.json @@ -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 + } +} diff --git a/AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon1x.png b/AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon1x.png new file mode 100644 index 0000000..a284539 Binary files /dev/null and b/AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon1x.png differ diff --git a/AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon2x.png b/AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon2x.png new file mode 100644 index 0000000..22701c9 Binary files /dev/null and b/AlDente/Assets.xcassets/menubaricon.imageset/aldentedarkicon2x.png differ diff --git a/AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon1x.png b/AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon1x.png new file mode 100644 index 0000000..fcc8790 Binary files /dev/null and b/AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon1x.png differ diff --git a/AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon2x.png b/AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon2x.png new file mode 100644 index 0000000..266e770 Binary files /dev/null and b/AlDente/Assets.xcassets/menubaricon.imageset/aldentelighticon2x.png differ diff --git a/AlDente/ContentView.swift b/AlDente/ContentView.swift index 74e5d54..4f19dfd 100644 --- a/AlDente/ContentView.swift +++ b/AlDente/ContentView.swift @@ -32,11 +32,16 @@ struct RedButtonStyle: ButtonStyle { } } +var osxScale:Bool = true + struct settings: 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: 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,7 +98,7 @@ struct settings: View { HStack(alignment: .center) { Spacer() VStack(alignment: .leading){ - Text("AlDente 🍝").font(.subheadline) + Text("AlDente 1.2 🍝").font(.subheadline) Button(action:{ let url = URL(string: "https://www.github.com/davidwernhart/AlDente")! if NSWorkspace.shared.open(url) { @@ -114,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 @@ -182,7 +200,8 @@ struct ContentView: View{ Spacer() if(self.showSettings){ - settings{Text("")} + //settings{Text("")} + settings({Text("")}) } }.frame(width: 400, height: adaptableHeight) @@ -195,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 + } } } @@ -209,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 + } + }) } diff --git a/Carthage/.DS_Store b/Carthage/.DS_Store index 0b108a2..42d40cc 100644 Binary files a/Carthage/.DS_Store and b/Carthage/.DS_Store differ diff --git a/Carthage/Build/.DS_Store b/Carthage/Build/.DS_Store index dc6a031..d9283a8 100644 Binary files a/Carthage/Build/.DS_Store and b/Carthage/Build/.DS_Store differ diff --git a/Carthage/Build/.LaunchAtLogin.version b/Carthage/Build/.LaunchAtLogin.version index 9e5c6dd..caecb60 100644 --- a/Carthage/Build/.LaunchAtLogin.version +++ b/Carthage/Build/.LaunchAtLogin.version @@ -1,19 +1,10 @@ { + "commitish" : "v3.0.0", "Mac" : [ { "name" : "LaunchAtLogin", - "hash" : "2e9388c5a92a57f855ee3fd4af35f7bd9ca52e5b9b45da92d64104cf31cb017d", - "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" : [ - ] } \ No newline at end of file diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework.dSYM/Contents/Resources/DWARF/LaunchAtLogin b/Carthage/Build/Mac/LaunchAtLogin.framework.dSYM/Contents/Resources/DWARF/LaunchAtLogin index 014d67d..37585fc 100644 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework.dSYM/Contents/Resources/DWARF/LaunchAtLogin and b/Carthage/Build/Mac/LaunchAtLogin.framework.dSYM/Contents/Resources/DWARF/LaunchAtLogin differ diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Headers/LaunchAtLogin-Swift.h b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Headers/LaunchAtLogin-Swift.h index a96006d..a4be910 100644 --- a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Headers/LaunchAtLogin-Swift.h +++ b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Headers/LaunchAtLogin-Swift.h @@ -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 diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/LaunchAtLogin b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/LaunchAtLogin index 7a0ffdb..2840f72 100755 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/LaunchAtLogin and b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/LaunchAtLogin differ diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftdoc b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftdoc index ad316cb..34f33d8 100644 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftdoc and b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftdoc differ diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftmodule b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftmodule index 9e946ea..9eeb9c1 100644 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftmodule and b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64-apple-macos.swiftmodule differ diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftdoc b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftdoc index ad316cb..34f33d8 100644 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftmodule b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftmodule index 9e946ea..9eeb9c1 100644 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Modules/LaunchAtLogin.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/Info.plist b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/Info.plist index 748d9cd..5c481be 100644 --- a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/Info.plist +++ b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 19D76 + 19F101 CFBundleExecutable LaunchAtLogin CFBundleIdentifier @@ -25,17 +25,17 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 11C504 + 11E608c DTPlatformVersion GM DTSDKBuild - 19B90 + 19E258 DTSDKName macosx10.15 DTXcode - 1130 + 1150 DTXcodeBuild - 11C504 + 11E608c LSMinimumSystemVersion 10.12 NSHumanReadableCopyright diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/Info.plist b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/Info.plist index 384d68b..ed98f10 100644 --- a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/Info.plist +++ b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 19D76 + 19F101 CFBundleExecutable LaunchAtLoginHelper CFBundleIdentifier @@ -25,17 +25,17 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 11C504 + 11E608c DTPlatformVersion GM DTSDKBuild - 19B90 + 19E258 DTSDKName macosx10.15 DTXcode - 1130 + 1150 DTXcodeBuild - 11C504 + 11E608c LSBackgroundOnly LSMinimumSystemVersion diff --git a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/MacOS/LaunchAtLoginHelper b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/MacOS/LaunchAtLoginHelper index bf4dd52..18a7fd6 100755 Binary files a/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/MacOS/LaunchAtLoginHelper and b/Carthage/Build/Mac/LaunchAtLogin.framework/Versions/A/Resources/LaunchAtLoginHelper.app/Contents/MacOS/LaunchAtLoginHelper differ