nixos-configs/config/ags/js/bar/brightness.js

38 lines
813 B
JavaScript
Raw Normal View History

import { Utils, Widget } from '../../imports.js';
const { ProgressBar, Overlay, Box } = Widget;
2023-09-11 19:57:21 -04:00
import { Separator } from '../misc/separator.js';
import { Heart } from './heart.js';
2023-09-08 15:15:04 -04:00
export const Brightness = Overlay({
setup: widget => {
widget.set_tooltip_text('Brightness');
},
child: ProgressBar({
className: 'toggle-off brightness',
connections: [
[200, progress => {
Utils.execAsync('brightnessctl get').then(out => {
2023-09-26 13:33:30 -04:00
let br = out / 255;
if (br > 0.33) {
progress.value = br;
}
else {
progress.value = 0.33;
}
}).catch(print);
}],
],
}),
overlays: [
Box({
style: 'color: #CBA6F7;',
children: [
Separator(25),
Heart,
],
}),
2023-09-08 15:15:04 -04:00
],
});