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