nixos-configs/hosts/wim/config/ags/js/bar/gesture.js

29 lines
512 B
JavaScript
Raw Normal View History

import { Widget, App } from '../../imports.js';
const { CenterBox, EventBox } = Widget;
import Gtk from 'gi://Gtk';
export default ({
child,
...props
}) => {
let widget = EventBox({
...props,
});
let gesture = Gtk.GestureSwipe.new(widget);
2023-10-17 23:21:24 -04:00
widget.add(CenterBox({
children: [ child ],
connections: [[gesture, () => {
const velocity = gesture.get_velocity()[1];
if (velocity < -100)
App.openWindow('quick-settings');
}, 'update']],
2023-10-17 23:21:24 -04:00
}));
return widget;
};