Adds a mAh (milliampere-hours) battery level indicator to the Mac bar.
This meme was created by the 4:00 AM gang.
By the way this is totally a joke, it's the first thing I ever wrote in Swift. lol gotem
Get it cause the screen was shot
...
- Prerequisites:
- XCode
- A MacBook
a will to live
- Clone the repository.
- Open the project in XCode.
- Press
⌘ R
(Command +R
) to run, or use the Build option from the menu. - Install the generated
.app
file into yourApplications
folder. - Go to
System Preferences
>Users and Groups
>Login Items
, click+
, and add the app. - Hold
⌘
and drag the little thing to wherever your little heart desires.
Why does anything exist? Does anything exist? 🤔
*cmatrix
intensifies*
Poorly.
JK. It works pretty well. It's very simple, too:
I blatantly copied some code from God-knows-where and put it in Battery.swift
, then wrote the BatteryAPI
as a completely
un-necessary frivolity to interface with it, with a series of highly complicated and useful functions such as:
func isCharging() -> String {
return String(battery.isCharging());
}
Yeah that's right. I use semicolons in Swift.
Oooh. Aaah.
Basically it's a bunch of menuitems
with an update function that does this:
statusItem.button?.title = batteryApi.currentCapacity(unit: true);
currentCapacityOutlet.title = "Current Capacity: " + batteryApi.currentCapacity();
maxCapacityOutlet.title = "Maximum Capacity: " + batteryApi.maxCapacity();
...
On a timer that looks like this:
Timer.scheduledTimer(
timeInterval: 5,
target: self,
selector: #selector(StatusMenuController.timerFire),
userInfo: nil,
repeats: true
);
Nah. I mean, if you really want to, I won't stop you. But there are probably many better things to do with your time.
This software is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License. 'Cause it's the CC license with the coolest name :) And also 'cause they say not to use it for code, and I'm that guy.
end my suffering