2023-10-02 12:06:35 -04:00
|
|
|
import { Utils, Widget } from '../../imports.js';
|
|
|
|
const { Box, Label } = Widget;
|
|
|
|
const { subprocess } = Utils;
|
2023-09-04 22:27:34 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
import EventBox from '../misc/cursorbox.js';
|
2023-09-04 22:47:12 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
2023-10-17 13:47:02 -04:00
|
|
|
export default () => EventBox({
|
2023-10-20 23:11:21 -04:00
|
|
|
className: 'toggle-off',
|
|
|
|
setup: self => {
|
|
|
|
subprocess(
|
|
|
|
['bash', '-c', '$AGS_PATH/osk-toggle.sh getState'],
|
|
|
|
output => self.toggleClassName('toggle-on', output === 'Running'),
|
|
|
|
);
|
|
|
|
},
|
2023-10-17 13:47:02 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
onPrimaryClickRelease: self => {
|
|
|
|
subprocess(
|
|
|
|
['bash', '-c', '$AGS_PATH/osk-toggle.sh toggle'],
|
|
|
|
output => self.toggleClassName('toggle-on', output !== 'Running'),
|
|
|
|
);
|
|
|
|
},
|
2023-10-17 13:47:02 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
child: Box({
|
|
|
|
className: 'osk-toggle',
|
|
|
|
vertical: false,
|
2023-09-04 22:27:34 -04:00
|
|
|
|
2023-10-20 23:11:21 -04:00
|
|
|
children: [
|
|
|
|
Label({
|
|
|
|
label: ' ',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}),
|
2023-09-04 22:27:34 -04:00
|
|
|
});
|