diff --git a/devices/wim/config/ags/js/bar/fullscreen.js b/devices/wim/config/ags/js/bar/fullscreen.js index 54ff60d..ebe198e 100644 --- a/devices/wim/config/ags/js/bar/fullscreen.js +++ b/devices/wim/config/ags/js/bar/fullscreen.js @@ -2,11 +2,10 @@ import App from 'resource:///com/github/Aylur/ags/app.js'; import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Variable from 'resource:///com/github/Aylur/ags/variable.js'; -import { Widget, Box, EventBox, Overlay } from 'resource:///com/github/Aylur/ags/widget.js'; +import { Box, EventBox, Overlay, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { timeout } from 'resource:///com/github/Aylur/ags/utils.js'; import { RoundedCorner } from '../screen-corners.js'; -import Gesture from './gesture.js'; const Revealed = Variable(true); const Hovering = Variable(false); @@ -31,17 +30,14 @@ export default props => Overlay({ hexpand: true, vertical: true, children: [ - Widget.Revealer({ + Revealer({ transition: 'slide_down', setup: self => self.revealChild = true, properties: [['timeouts', []]], connections: [[Revealed, self => { - const Bar = App.getWindow('bar'); - Bar.setCss(Revealed.value ? '' : wStyle); - - const BgGradient = App.getWindow('bg-gradient'); - BgGradient.visible = !Revealed.value; + App.getWindow('bar').setCss(Revealed.value ? '' : wStyle); + App.getWindow('bg-gradient').visible = !Revealed.value; if (Revealed.value) { timeout(2000, () => { @@ -54,13 +50,14 @@ export default props => Overlay({ } }]], - child: Gesture({ + child: EventBox({ onHover: () => Hovering.value = true, onHoverLost: self => { Hovering.value = false; if (Revealed.value) { timeout(2000, () => { if (!Hovering.value) { + // Replace bar with transparent eventbox self.get_parent().get_parent().children[1].revealChild = true; self.get_parent().revealChild = false; } @@ -71,7 +68,7 @@ export default props => Overlay({ }), }), - Widget.Revealer({ + Revealer({ connections: [[Revealed, self => { if (Revealed.value) { timeout(2000, () => { @@ -86,11 +83,13 @@ export default props => Overlay({ child: EventBox({ onHover: self => { Hovering.value = true; + + // Replace eventbox with bar self.get_parent().get_parent().children[0].revealChild = true; self.get_parent().revealChild = false; }, child: Box({ - css: 'min-height: 50px;', + css: 'min-height: 5px;', }), }), }), diff --git a/devices/wim/config/ags/js/bar/gesture.js b/devices/wim/config/ags/js/bar/gesture.js deleted file mode 100644 index 1107c55..0000000 --- a/devices/wim/config/ags/js/bar/gesture.js +++ /dev/null @@ -1,27 +0,0 @@ -import App from 'resource:///com/github/Aylur/ags/app.js'; -import { CenterBox, EventBox } from 'resource:///com/github/Aylur/ags/widget.js'; - -import Gtk from 'gi://Gtk'; - - -export default ({ - child, - ...props -}) => { - const widget = EventBox({ - ...props, - }); - - const gesture = Gtk.GestureSwipe.new(widget); - - widget.add(CenterBox({ - children: [child], - connections: [[gesture, () => { - const velocity = gesture.get_velocity()[1]; - if (velocity < -100) - App.openWindow('applauncher'); - }, 'update']], - })); - - return widget; -}; diff --git a/devices/wim/config/ags/js/setup.js b/devices/wim/config/ags/js/setup.js index 5c07326..6016a87 100644 --- a/devices/wim/config/ags/js/setup.js +++ b/devices/wim/config/ags/js/setup.js @@ -1,3 +1,4 @@ +import App from 'resource:///com/github/Aylur/ags/app.js'; import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import Tablet from '../services/tablet.js'; @@ -13,6 +14,13 @@ export default () => { execAsync(['bash', '-c', '$AGS_PATH/startup.sh']).catch(print); + TouchGestures.addGesture({ + name: 'openAppLauncher', + gesture: 'UD', + edge: 'T', + command: () => App.openWindow('applauncher'), + }); + TouchGestures.addGesture({ name: 'oskOn', gesture: 'DU', diff --git a/devices/wim/config/ags/services/touch-gestures.js b/devices/wim/config/ags/services/touch-gestures.js index da61af2..0dcd191 100644 --- a/devices/wim/config/ags/services/touch-gestures.js +++ b/devices/wim/config/ags/services/touch-gestures.js @@ -78,6 +78,11 @@ class TouchGestures extends Service { return; } + if (typeof command !== 'string') { + globalThis[name] = command; + command = `ags -r "${name}()"`; + } + this.gestures.set(name, [ '-g', `${nFingers},${gesture},${edge},${distance},${command}`,