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

27 lines
557 B
JavaScript
Raw Normal View History

2023-09-04 22:44:00 -04:00
const { Box, Label } = ags.Widget;
const { subprocess, exec } = ags.Utils;
const deflisten = subprocess;
2023-09-04 22:27:34 -04:00
2023-09-11 19:57:21 -04:00
import { EventBox } from '../misc/cursorbox.js';
2023-09-04 22:27:34 -04:00
2023-09-04 22:44:00 -04:00
deflisten(
2023-09-04 22:27:34 -04:00
['bash', '-c', 'tail -f /home/matt/.config/.heart'],
(output) => {
Heart.child.children[0].label = ' ' + output;
},
);
export const Heart = EventBox({
halign: 'center',
2023-09-04 22:44:00 -04:00
onPrimaryClickRelease: () => {
exec("bash -c '$AGS_PATH/heart.sh toggle'");
2023-09-04 22:27:34 -04:00
},
2023-09-04 22:44:00 -04:00
child: Box({
2023-09-04 22:27:34 -04:00
className: 'heart-toggle',
vertical: false,
2023-09-04 22:44:00 -04:00
child: Label({
2023-09-04 22:27:34 -04:00
label: '',
}),
}),
});