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

34 lines
750 B
JavaScript
Raw Normal View History

import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
2023-11-16 00:48:50 -05:00
import EventBox from '../../misc/cursorbox.js';
import Persist from '../../misc/persist.js';
2023-09-04 22:27:34 -04:00
const HeartState = Variable();
Persist({
name: 'heart',
gobject: HeartState,
prop: 'value',
condition: '',
whenFalse: '󰣐',
});
2023-09-04 22:27:34 -04:00
export default () => {
return EventBox({
onPrimaryClickRelease: () => {
HeartState.value = HeartState.value === '' ? '󰣐' : '';
},
child: Box({
className: 'heart-toggle',
child: Label({
binds: [['label', HeartState, 'value']],
}),
}),
});
};