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

33 lines
780 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';
/* Types */
import { OskWindow } from 'global-types';
// 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',
layer: 'overlay',
2023-11-19 16:25:01 -05:00
anchor: ['left', 'bottom', 'right'],
})
.hook(Tablet, (self: OskWindow, state) => {
self.attribute.setVisible(state);
}, 'osk-toggled')
.hook(Tablet, () => {
window.visible = !(!Tablet.tabletMode && !Tablet.oskState);
}, 'mode-toggled');
window.child = Keyboard(window);
2023-11-19 16:25:01 -05:00
return Gesture(window);
};