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

34 lines
870 B
JavaScript
Raw Normal View History

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