2023-11-19 20:39:08 -05:00
|
|
|
import { Window } from 'resource:///com/github/Aylur/ags/widget.js';
|
2023-11-19 15:00:29 -05:00
|
|
|
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
|
|
|
|
|
2023-11-21 01:29:46 -05:00
|
|
|
import Tablet from '../../services/tablet.js';
|
2023-11-19 15:00:29 -05:00
|
|
|
import Gesture from './gesture.js';
|
|
|
|
import Keyboard from './keyboard.js';
|
|
|
|
|
|
|
|
|
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,
|
2023-11-19 16:25:01 -05:00
|
|
|
anchor: ['left', 'bottom', 'right'],
|
2023-11-21 01:29:46 -05:00
|
|
|
|
2023-11-19 20:39:08 -05:00
|
|
|
connections: [
|
|
|
|
[Tablet, (self, state) => {
|
|
|
|
self.setVisible(state);
|
|
|
|
}, 'osk-toggled'],
|
|
|
|
|
|
|
|
[Tablet, () => {
|
2023-11-21 01:29:46 -05:00
|
|
|
if (!Tablet.tabletMode && !Tablet.oskState) {
|
2023-11-19 20:39:08 -05:00
|
|
|
window.visible = false;
|
2023-11-21 01:29:46 -05:00
|
|
|
}
|
2023-11-19 20:39:08 -05:00
|
|
|
}, '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);
|
|
|
|
};
|