nixos-configs/devices/wim/config/ags/js/bar/osk-toggle.js

34 lines
862 B
JavaScript
Raw Normal View History

import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { subprocess } from 'resource:///com/github/Aylur/ags/utils.js';
2023-09-04 22:27:34 -04:00
import EventBox from '../misc/cursorbox.js';
2023-09-04 22:47:12 -04:00
export default () => EventBox({
className: 'toggle-off',
setup: self => {
subprocess(
['bash', '-c', '$AGS_PATH/osk-toggle.sh getState'],
output => self.toggleClassName('toggle-on', output === 'Running'),
);
},
onPrimaryClickRelease: self => {
subprocess(
['bash', '-c', '$AGS_PATH/osk-toggle.sh toggle'],
output => self.toggleClassName('toggle-on', output !== 'Running'),
);
},
child: Box({
className: 'osk-toggle',
vertical: false,
2023-09-04 22:27:34 -04:00
children: [
Label({
label: ' 󰌌 ',
}),
],
}),
2023-09-04 22:27:34 -04:00
});