nixos-configs/devices/wim/config/ags/js/bar/buttons/heart.js

29 lines
750 B
JavaScript
Raw Normal View History

import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { subprocess, execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
2023-09-04 22:27:34 -04:00
2023-11-16 00:48:50 -05:00
import EventBox from '../../misc/cursorbox.js';
2023-09-04 22:27:34 -04:00
export default () => EventBox({
2023-11-06 18:37:23 -05:00
hpack: 'center',
onPrimaryClickRelease: () => {
execAsync(['bash', '-c', '$AGS_PATH/heart.sh toggle']).catch(print);
},
child: Box({
className: 'heart-toggle',
vertical: false,
2023-09-04 22:27:34 -04:00
child: Label({
label: '',
setup: self => {
subprocess(
['bash', '-c', 'tail -f /home/matt/.config/.heart'],
output => self.label = ' ' + output,
);
},
}),
2023-09-04 22:27:34 -04:00
}),
});