Skip to content

Instantly share code, notes, and snippets.

View peheje's full-sized avatar

Peter peheje

View GitHub Profile
@peheje
peheje / battery.sh
Last active July 21, 2024 15:20
linux auto-switch battery profile based on AC/Battery status
#!/bin/bash
get_power_source() {
if [ -f /sys/class/power_supply/ACAD/online ]; then
cat /sys/class/power_supply/ACAD/online
else
echo "Unable to determine power source"
exit 1
fi
}