updated battery module
This commit is contained in:
1 parent
f1c32ead5d
commit
1423da4034
4 files changed
+10
-1
No files matched your search
@@ -0,0 +1,8 @@
|
||||
.Battery {
|
||||
icon {
|
||||
margin: 0 5px;
|
||||
}
|
||||
label {
|
||||
margin: 0 5px 0 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { bind } from "astal"
|
||||
import Battery from "gi://AstalBattery"
|
||||
|
||||
export default function BatteryLevel() {
|
||||
const bat = Battery.get_default()
|
||||
console.log(bat.charging, bat.capacity, bat.energyFull, bat.energy_full_design)
|
||||
|
||||
return <box className="Battery"
|
||||
visible={bind(bat, "isPresent")}>
|
||||
<icon icon={bind(bat, "batteryIconName")} />
|
||||
<label label={bind(bat, "percentage").as(p =>
|
||||
`${Math.floor(p * 100)} %`
|
||||
)} />
|
||||
</box>
|
||||
}
|
||||
Reference in new issue
Block a user