From a16d7d474870c1123863fcac534a78600d5b2d2e Mon Sep 17 00:00:00 2001 From: matt1432 Date: Mon, 6 Nov 2023 21:36:12 -0500 Subject: [PATCH] feat(ags pointers): add stay as choice for popup windows --- devices/wim/config/ags/js/bar/osk-toggle.js | 4 +--- devices/wim/config/ags/js/bar/quick-settings.js | 4 +--- devices/wim/config/ags/js/bar/tablet-toggle.js | 4 +--- devices/wim/config/ags/js/media-player/gesture.js | 2 +- devices/wim/config/ags/js/media-player/mpris.js | 6 ++---- devices/wim/config/ags/js/misc/closer.js | 2 +- devices/wim/config/ags/js/notifications/popup.js | 2 +- devices/wim/config/ags/services/pointers.js | 5 +++-- 8 files changed, 11 insertions(+), 18 deletions(-) diff --git a/devices/wim/config/ags/js/bar/osk-toggle.js b/devices/wim/config/ags/js/bar/osk-toggle.js index 044ed1f7..214c8517 100644 --- a/devices/wim/config/ags/js/bar/osk-toggle.js +++ b/devices/wim/config/ags/js/bar/osk-toggle.js @@ -14,8 +14,6 @@ export default () => EventBox({ child: Box({ className: 'osk-toggle', vertical: false, - children: [Label({ - label: ' 󰌌 ', - })], + children: [Label(' 󰌌 ')], }), }); diff --git a/devices/wim/config/ags/js/bar/quick-settings.js b/devices/wim/config/ags/js/bar/quick-settings.js index 32e027af..e45b70d9 100644 --- a/devices/wim/config/ags/js/bar/quick-settings.js +++ b/devices/wim/config/ags/js/bar/quick-settings.js @@ -14,8 +14,6 @@ export default () => EventBox({ child: Box({ className: 'quick-settings-toggle', vertical: false, - child: Label({ - label: '  ', - }), + child: Label('  '), }), }); diff --git a/devices/wim/config/ags/js/bar/tablet-toggle.js b/devices/wim/config/ags/js/bar/tablet-toggle.js index 96476251..a900b65b 100644 --- a/devices/wim/config/ags/js/bar/tablet-toggle.js +++ b/devices/wim/config/ags/js/bar/tablet-toggle.js @@ -14,8 +14,6 @@ export default () => EventBox({ child: Box({ className: 'tablet-toggle', vertical: false, - children: [Label({ - label: ' 󰦧 ', - })], + children: [Label(' 󰦧 ')], }), }); diff --git a/devices/wim/config/ags/js/media-player/gesture.js b/devices/wim/config/ags/js/media-player/gesture.js index d45f8f9f..a08d5d68 100644 --- a/devices/wim/config/ags/js/media-player/gesture.js +++ b/devices/wim/config/ags/js/media-player/gesture.js @@ -13,7 +13,7 @@ export default ({ connections, props, } = {}) => { - const widget = EventBox({}); + const widget = EventBox(); const gesture = Gtk.GestureDrag.new(widget); widget.add(Overlay({ diff --git a/devices/wim/config/ags/js/media-player/mpris.js b/devices/wim/config/ags/js/media-player/mpris.js index 0390a07a..178e5efb 100644 --- a/devices/wim/config/ags/js/media-player/mpris.js +++ b/devices/wim/config/ags/js/media-player/mpris.js @@ -162,10 +162,8 @@ export const PositionSlider = (player, props) => EventBox({ .new_from_name(display, 'grabbing')); } else { - if (slider.get_parent() && slider.get_parent().window) { - slider.get_parent().window.set_cursor(Gdk.Cursor - .new_from_name(display, 'pointer')); - } + slider.get_parent()?.window?.set_cursor(Gdk.Cursor + .new_from_name(display, 'pointer')); slider.visible = player.length > 0; if (player.length > 0) diff --git a/devices/wim/config/ags/js/misc/closer.js b/devices/wim/config/ags/js/misc/closer.js index 94c8e06a..752962a9 100644 --- a/devices/wim/config/ags/js/misc/closer.js +++ b/devices/wim/config/ags/js/misc/closer.js @@ -3,7 +3,7 @@ import App from 'resource:///com/github/Aylur/ags/app.js'; export default () => { Array.from(App.windows) - .filter(w => w[1].closeOnUnfocus) + .filter(w => w[1].closeOnUnfocus && w[1].closeOnUnfocus !== 'stay') .forEach(w => { App.closeWindow(w[0]); }); diff --git a/devices/wim/config/ags/js/notifications/popup.js b/devices/wim/config/ags/js/notifications/popup.js index 36300992..0197240c 100644 --- a/devices/wim/config/ags/js/notifications/popup.js +++ b/devices/wim/config/ags/js/notifications/popup.js @@ -56,7 +56,7 @@ export default () => PopupWindow({ anchor: ['top', 'left'], visible: true, transition: 'none', - closeOnUnfocus: 'none', + closeOnUnfocus: 'stay', child: Box({ vertical: true, connections: [ diff --git a/devices/wim/config/ags/services/pointers.js b/devices/wim/config/ags/services/pointers.js index 542d2172..006816db 100644 --- a/devices/wim/config/ags/services/pointers.js +++ b/devices/wim/config/ags/services/pointers.js @@ -123,8 +123,9 @@ class Pointers extends Service { initAppConnection() { App.connect('window-toggled', () => { const anyVisibleAndClosable = Array.from(App.windows).some(w => { - const closable = (w[1].closeOnUnfocus && - w[1].closeOnUnfocus !== 'none'); + const closable = w[1].closeOnUnfocus && + !(w[1].closeOnUnfocus === 'none' || + w[1].closeOnUnfocus === 'stay'); return w[1].visible && closable; });