33 lines
584 B
JavaScript
33 lines
584 B
JavaScript
|
const { Window, CenterBox, EventBox, Button } = ags.Widget;
|
||
|
const { openWindow } = ags.App;
|
||
|
const { Gtk, Gdk } = imports.gi;
|
||
|
const display = Gdk.Display.get_default();
|
||
|
|
||
|
export const Gesture = ({
|
||
|
child,
|
||
|
...params
|
||
|
}) => {
|
||
|
let w = EventBox({
|
||
|
...params,
|
||
|
});
|
||
|
|
||
|
let gesture = Gtk.GestureSwipe.new(w);
|
||
|
|
||
|
w.child = CenterBox({
|
||
|
children: [
|
||
|
child,
|
||
|
],
|
||
|
connections: [
|
||
|
|
||
|
[gesture, box => {
|
||
|
const velocity = gesture.get_velocity()[1];
|
||
|
if (velocity < -50)
|
||
|
openWindow('quick-settings');
|
||
|
}, 'update'],
|
||
|
|
||
|
],
|
||
|
});
|
||
|
|
||
|
return w;
|
||
|
};
|