nixos-configs/modules/ags/config/ts/on-screen-keyboard/main.ts
matt1432 3a8cc994f2
All checks were successful
Discord / discord commits (push) Has been skipped
refactor(ags): switch back to global imports
2024-01-30 11:29:07 -05:00

38 lines
966 B
TypeScript

const { Window } = Widget;
const { execAsync } = Utils;
import Tablet from '../../services/tablet.ts';
import Gesture from './gesture.ts';
import Keyboard from './keyboard.ts';
// Start ydotool daemon
execAsync('ydotoold').catch(print);
// Window
export default () => {
const window = Window({
name: 'osk',
visible: false,
layer: 'overlay',
anchor: ['left', 'bottom', 'right'],
setup: (self) => {
self
.hook(Tablet, (_, state) => {
// @ts-expect-error too lazy to do keyboard type
self.attribute.setVisible(state);
}, 'osk-toggled')
.hook(Tablet, () => {
if (!Tablet.tabletMode && !Tablet.oskState) {
window.visible = false;
}
}, 'mode-toggled');
},
});
window.child = Keyboard(window);
return Gesture(window);
};