aboutsummaryrefslogtreecommitdiff
path: root/.config/ags/lib/battery.ts
blob: 38172602162fda6d5b9f2dbe490e8c79a44328a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import icons from "./icons"

export default async function init() {
    const bat = await Service.import("battery")
    bat.connect("notify::percent", ({ percent, charging }) => {
        const low = 30
        if (percent !== low || percent !== low / 2 || !charging)
            return

        Utils.notify({
            summary: `${percent}% Battery Percentage`,
            iconName: icons.battery.warning,
            urgency: "critical",
        })
    })
}