nixos-configs/devices/wim/config/ags/js/on-screen-keyboard/main.js

37 lines
945 B
JavaScript
Raw Normal View History

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.js';
import Gesture from './gesture.js';
import Keyboard from './keyboard.js';
// 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',
visible: false,
2023-11-19 16:25:01 -05:00
anchor: ['left', 'bottom', 'right'],
setup: (self) => {
self
.hook(Tablet, (_, state) => {
self.setVisible(state);
}, 'osk-toggled')
.hook(Tablet, () => {
if (!Tablet.tabletMode && !Tablet.oskState) {
window.visible = false;
}
}, 'mode-toggled');
},
2023-11-19 16:25:01 -05:00
});
window.child = Keyboard(window);
2023-11-19 16:25:01 -05:00
return Gesture(window);
};