nixos-configs/devices/wim/config/ags/ts/on-screen-keyboard/main.ts
matt1432 2f4781e60e
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags pointers): make list of widgets that don't close others when clicked on
2024-01-16 11:26:35 -05:00

37 lines
981 B
TypeScript

import { Window } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
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) => {
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);
};