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';
|
|
|
|
|
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,
|
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) => {
|
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);
|
|
|
|
};
|