fix(agsV2): fix popup timer problems
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
276c399f49
commit
cb3027e571
2 changed files with 11 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { Gdk, Gtk, Widget } from 'astal/gtk3';
|
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 { idle, interval } from 'astal';
|
||||||
|
|
||||||
import AstalIO from 'gi://AstalIO?version=0.1';
|
import AstalIO from 'gi://AstalIO?version=0.1';
|
||||||
|
@ -76,11 +76,12 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
||||||
|
|
||||||
private timer_object: AstalIO.Time | undefined;
|
private timer_object: AstalIO.Time | undefined;
|
||||||
|
|
||||||
@property(Number)
|
public popup_timer: number;
|
||||||
declare popup_timer: number;
|
|
||||||
|
|
||||||
@property(Boolean)
|
@signal(Number)
|
||||||
declare dragging: boolean;
|
declare timer_update: (popup_timer: number) => void;
|
||||||
|
|
||||||
|
public dragging: boolean;
|
||||||
|
|
||||||
private async get_hovered(): Promise<boolean> {
|
private async get_hovered(): Promise<boolean> {
|
||||||
const layers = JSON.parse(await hyprMessage('j/layers')) as LayerResult;
|
const layers = JSON.parse(await hyprMessage('j/layers')) as LayerResult;
|
||||||
|
@ -164,9 +165,11 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.slide_in_from = slide_in_from;
|
this.slide_in_from = slide_in_from;
|
||||||
this.popup_timer = popup_timer;
|
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
|
|
||||||
|
this.popup_timer = popup_timer;
|
||||||
|
this.timer_update(this.popup_timer);
|
||||||
|
|
||||||
// OnClick
|
// OnClick
|
||||||
this.connect('button-press-event', () => {
|
this.connect('button-press-event', () => {
|
||||||
if (!display) {
|
if (!display) {
|
||||||
|
@ -219,7 +222,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
||||||
this.slideAway('Left');
|
this.slideAway('Left');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.popup_timer--;
|
this.timer_update(--this.popup_timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -115,7 +115,7 @@ export const Notification = ({
|
||||||
id={id}
|
id={id}
|
||||||
popup_timer={popup_timer}
|
popup_timer={popup_timer}
|
||||||
setup_notif={(self) => {
|
setup_notif={(self) => {
|
||||||
self.connect('notify::popup-timer', () => {
|
self.connect('timer-update', () => {
|
||||||
progress.fraction = self.popup_timer / 5;
|
progress.fraction = self.popup_timer / 5;
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue