mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-18 12:11:54 +00:00
- Add complete colorshell v2.0.3 configuration to home/ags-config/ - Disable runner plugin and NightLight tile (incompatible with NixOS) - Customize SCSS with full opacity (no transparency) - Add dark pale blue color scheme in home/pywal-colors/ - Configure Papirus-Dark icon theme via home-manager - Make ~/.config/ags/ immutable and managed by Nix store - Auto-deploy pywal colors to ~/.cache/wal/colors.json All AGS configuration is now reproducible and version controlled.
39 lines
933 B
TypeScript
39 lines
933 B
TypeScript
import { Accessor, createBinding } from "ags";
|
|
import AstalBattery from "gi://AstalBattery?version=0.1";
|
|
|
|
export class Battery {
|
|
private static astalBattery: AstalBattery.Device = AstalBattery.get_default();
|
|
|
|
private static batteryInst: Battery;
|
|
|
|
constructor() {
|
|
AstalBattery.get_default();
|
|
}
|
|
|
|
public static getDefault(): Battery {
|
|
if (!this.batteryInst) {
|
|
this.batteryInst = new Battery();
|
|
}
|
|
|
|
return this.batteryInst;
|
|
}
|
|
|
|
public static getBattery(): AstalBattery.Device {
|
|
return this.astalBattery;
|
|
}
|
|
|
|
public bindHasBattery(): Accessor<boolean> {
|
|
return createBinding(Battery.getBattery(), "isBattery");
|
|
}
|
|
|
|
public bindPercentage(): Accessor<string> {
|
|
return createBinding(Battery.getBattery(), "percentage").as(
|
|
(v) => Math.round(v * 100) + "%"
|
|
);
|
|
}
|
|
|
|
public bindIcon(): Accessor<string> {
|
|
return createBinding(Battery.getBattery(), "battery_icon_name");
|
|
}
|
|
}
|