2024-01-30 11:29:07 -05:00
|
|
|
const { Window } = Widget;
|
|
|
|
const { execAsync } = Utils;
|
2023-11-19 15:00:29 -05:00
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import Tablet from '../../services/tablet.ts';
|
|
|
|
import Gesture from './gesture.ts';
|
|
|
|
import Keyboard from './keyboard.ts';
|
2023-11-19 15:00:29 -05:00
|
|
|
|
|
|
|
|
2023-11-21 01:29:46 -05:00
|
|
|
// Start ydotool daemon
|
2023-11-19 15:00:29 -05:00
|
|
|
execAsync('ydotoold').catch(print);
|
|
|
|
|
|
|
|
// Window
|
2023-11-19 16:25:01 -05:00
|
|
|
export default () => {
|
2023-11-19 20:39:08 -05:00
|
|
|
const window = Window({
|
2023-11-19 16:25:01 -05:00
|
|
|
name: 'osk',
|
2023-11-19 20:39:08 -05:00
|
|
|
visible: false,
|
2024-01-16 11:26:35 -05:00
|
|
|
layer: 'overlay',
|
2023-11-19 16:25:01 -05:00
|
|
|
anchor: ['left', 'bottom', 'right'],
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-12-17 00:01:58 -05:00
|
|
|
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);
|
2023-12-17 00:01:58 -05:00
|
|
|
}, 'osk-toggled')
|
|
|
|
|
|
|
|
.hook(Tablet, () => {
|
|
|
|
if (!Tablet.tabletMode && !Tablet.oskState) {
|
|
|
|
window.visible = false;
|
|
|
|
}
|
|
|
|
}, 'mode-toggled');
|
|
|
|
},
|
2023-11-19 16:25:01 -05:00
|
|
|
});
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-11-19 20:39:08 -05:00
|
|
|
window.child = Keyboard(window);
|
2023-11-19 16:25:01 -05:00
|
|
|
|
|
|
|
return Gesture(window);
|
|
|
|
};
|