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

35 lines
742 B
JavaScript
Raw Normal View History

import { Utils, Widget } from '../../imports.js';
const { Box, Label } = Widget;
const { subprocess } = Utils;
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({
2023-09-04 22:27:34 -04:00
className: 'toggle-off',
setup: self => {
subprocess(
['bash', '-c', '$AGS_PATH/osk-toggle.sh getState'],
(output) => self.toggleClassName('toggle-on', output === 'Running'),
);
},
onPrimaryClickRelease: self => {
2023-09-04 22:47:12 -04:00
subprocess(
['bash', '-c', '$AGS_PATH/osk-toggle.sh toggle'],
(output) => self.toggleClassName('toggle-on', output !== 'Running'),
2023-09-04 22:27:34 -04:00
);
},
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: " 󰌌 ",
}),
],
}),
});