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-09-11 19:57:21 -04:00
|
|
|
import { EventBox } from '../misc/cursorbox.js';
|
2023-09-04 22:47:12 -04:00
|
|
|
|
2023-10-02 12:06:35 -04:00
|
|
|
|
|
|
|
subprocess(
|
2023-09-07 23:18:39 -04:00
|
|
|
['bash', '-c', '$AGS_PATH/osk-toggle.sh getState'],
|
2023-09-04 22:27:34 -04:00
|
|
|
(output) => {
|
|
|
|
if (output == 'Running') {
|
|
|
|
OskToggle.toggleClassName('toggle-on', true);
|
|
|
|
} else {
|
|
|
|
OskToggle.toggleClassName('toggle-on', false);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
export const OskToggle = EventBox({
|
|
|
|
className: 'toggle-off',
|
|
|
|
onPrimaryClickRelease: function() {
|
2023-09-04 22:47:12 -04:00
|
|
|
subprocess(
|
2023-09-07 23:18:39 -04:00
|
|
|
['bash', '-c', '$AGS_PATH/osk-toggle.sh toggle'],
|
2023-09-04 22:27:34 -04:00
|
|
|
(output) => {
|
|
|
|
if (output == 'Running') {
|
|
|
|
OskToggle.toggleClassName('toggle-on', false);
|
|
|
|
} else {
|
|
|
|
OskToggle.toggleClassName('toggle-on', true);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
2023-09-04 22:47:12 -04:00
|
|
|
child: Box({
|
2023-09-04 22:27:34 -04:00
|
|
|
className: 'osk-toggle',
|
|
|
|
vertical: false,
|
|
|
|
|
|
|
|
children: [
|
2023-09-04 22:47:12 -04:00
|
|
|
Label({
|
2023-09-04 22:27:34 -04:00
|
|
|
label: " ",
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
});
|