import { bind } from "astal"; import Battery from "gi://AstalBattery"; import accent from "../../accent.css"; export default function BatteryLevel() { const bat = Battery.get_default(); const percent = bind(bat, "percentage").as(p => Math.floor(p * 100)); return ( ` background-image: linear-gradient( to right, ${accent} 0%, ${accent} ${p}%, transparent ${p}%, transparent 100% ); background-size: 100% 3px; background-repeat: no-repeat; background-position: bottom; `)} > ); }