[AGS] Battery, Brightness: Improve design

This commit is contained in:
Janis Hutz 2025-04-26 13:29:16 +02:00
parent 678afa99d6
commit 86e963e408
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,5 @@
import { bind } from "astal"; import { bind } from "astal";
import Battery from "gi://AstalBattery"; import Battery from "gi://AstalBattery";
import { Gtk } from "astal/gtk4";
export const BatteryBox = () => { export const BatteryBox = () => {
const battery = Battery.get_default(); const battery = Battery.get_default();
@ -26,10 +25,15 @@ export const BatteryBox = () => {
)} )}
/> />
<label <label
cssClasses={["time"]} cssClasses={["battery-time"]}
visible={bind(battery, "charging").as(c => !c)} visible={bind(battery, "charging").as(c => !c)}
label={bind(battery, "timeToEmpty").as(t => `(${toTime(t)})`)} label={bind(battery, "timeToEmpty").as(t => `(${toTime(t)})`)}
/> />
<label
cssClasses={["battery-time"]}
visible={bind(battery, "charging")}
label={bind(battery, "timeToFull").as(t => `(${toTime(t)})`)}
/>
</box> </box>
); );
}; };

View File

@ -12,7 +12,7 @@ const BrightnessModule = () => {
<image iconName={"brightness-high-symbolic"}></image> <image iconName={"brightness-high-symbolic"}></image>
<label label={bind(brightness, "screen").as(b => `${Math.round(100 * b)}%`)}></label> <label label={bind(brightness, "screen").as(b => `${Math.round(100 * b)}%`)}></label>
<slider <slider
value={bind(brightness, "screen").as(b => Math.round(100 * b))} value={bind(brightness, "screen").as(b => 100 * b)}
hexpand hexpand
max={100} max={100}
min={0} min={0}