Add ags
This commit is contained in:
parent
3648827637
commit
c8d7b4c090
8 changed files with 415 additions and 0 deletions
24
misc/.config/ags/modules/bar/battery.js
Normal file
24
misc/.config/ags/modules/bar/battery.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
const { exec, execAsync } = Utils;
|
||||
|
||||
export const Battery = () => Widget.Button({
|
||||
class_name: "battery",
|
||||
child: Widget.Label({
|
||||
setup: (self) => {self.poll(1000, (self) =>
|
||||
execAsync("block_battery")
|
||||
.then((out) => {
|
||||
self.label = out;
|
||||
let num = Number(out.substring(2, out.length - 1));
|
||||
|
||||
// Turn red at low battery
|
||||
if (num < 20) {
|
||||
self.class_name = "module, critical";
|
||||
} else {
|
||||
self.class_name = "module";
|
||||
};
|
||||
})
|
||||
.catch(console.error),
|
||||
)},
|
||||
}),
|
||||
on_clicked: () => {},
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue