From cb3027e5714d4a44c38eeea5a40bc593221727f1 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 16 Oct 2024 13:00:10 -0400 Subject: [PATCH] fix(agsV2): fix popup timer problems --- nixosModules/ags/v2/widgets/notifs/gesture.tsx | 17 ++++++++++------- .../ags/v2/widgets/notifs/notification.tsx | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/nixosModules/ags/v2/widgets/notifs/gesture.tsx b/nixosModules/ags/v2/widgets/notifs/gesture.tsx index 272762d3..49a4dfb2 100644 --- a/nixosModules/ags/v2/widgets/notifs/gesture.tsx +++ b/nixosModules/ags/v2/widgets/notifs/gesture.tsx @@ -1,5 +1,5 @@ import { Gdk, Gtk, Widget } from 'astal/gtk3'; -import { register, property } from 'astal/gobject'; +import { register, signal } from 'astal/gobject'; import { idle, interval } from 'astal'; import AstalIO from 'gi://AstalIO?version=0.1'; @@ -76,11 +76,12 @@ export class NotifGestureWrapper extends Widget.EventBox { private timer_object: AstalIO.Time | undefined; - @property(Number) - declare popup_timer: number; + public popup_timer: number; - @property(Boolean) - declare dragging: boolean; + @signal(Number) + declare timer_update: (popup_timer: number) => void; + + public dragging: boolean; private async get_hovered(): Promise { const layers = JSON.parse(await hyprMessage('j/layers')) as LayerResult; @@ -164,9 +165,11 @@ export class NotifGestureWrapper extends Widget.EventBox { this.id = id; this.slide_in_from = slide_in_from; - this.popup_timer = popup_timer; this.dragging = false; + this.popup_timer = popup_timer; + this.timer_update(this.popup_timer); + // OnClick this.connect('button-press-event', () => { if (!display) { @@ -219,7 +222,7 @@ export class NotifGestureWrapper extends Widget.EventBox { this.slideAway('Left'); } else { - this.popup_timer--; + this.timer_update(--this.popup_timer); } } }); diff --git a/nixosModules/ags/v2/widgets/notifs/notification.tsx b/nixosModules/ags/v2/widgets/notifs/notification.tsx index db964993..f53f92d9 100644 --- a/nixosModules/ags/v2/widgets/notifs/notification.tsx +++ b/nixosModules/ags/v2/widgets/notifs/notification.tsx @@ -115,7 +115,7 @@ export const Notification = ({ id={id} popup_timer={popup_timer} setup_notif={(self) => { - self.connect('notify::popup-timer', () => { + self.connect('timer-update', () => { progress.fraction = self.popup_timer / 5; }); }}