// Menu: Battery Monitor// Description: Check if AC should be disconnected? Poorman's AlDente// Author: Richard Dyce// Twitter: @dickiedyce// schedule: 0,15,20,45 5-22 * * *import "@johnlindquist/kit"const result = await exec(`pmset -g batt`)const charge = 1 * result.stdout.match(/(\d+)\%/)[1]const state = result.stdout.match(/(discharging|charging)/)[0]const source = result.stdout.match(/(Battery Power|AC Power)/)[0]if(charge > 80 && source == 'AC Power' ) {notify(`UNPLUG! The laptop is ${state} from ${source}, at ${charge}%`)} else if (charge < 40 && source == 'Battery Power') {notify(`PLUG-IN! The laptop is ${state} from ${source}, at ${charge}%`)} else {// notify(`The laptop is ${state} from ${source}, at ${charge}%`)}