nixos-configs/modules/ags/config/ts/on-screen-keyboard/main.ts

39 lines
966 B
TypeScript
Raw Normal View History

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
2023-11-19 16:25:01 -05:00
export default () => {
const window = Window({
2023-11-19 16:25:01 -05:00
name: 'osk',
visible: false,
layer: 'overlay',
2023-11-19 16:25:01 -05:00
anchor: ['left', 'bottom', 'right'],
setup: (self) => {
self
.hook(Tablet, (_, state) => {
2024-01-29 20:56:56 -05:00
// @ts-expect-error too lazy to do keyboard type
2023-12-21 01:25:59 -05:00
self.attribute.setVisible(state);
}, 'osk-toggled')
.hook(Tablet, () => {
if (!Tablet.tabletMode && !Tablet.oskState) {
window.visible = false;
}
}, 'mode-toggled');
},
2023-11-19 16:25:01 -05:00
});
window.child = Keyboard(window);
2023-11-19 16:25:01 -05:00
return Gesture(window);
};