feat(config): implement configurations

This commit is contained in:
retrozinndev
2025-06-26 15:12:24 -03:00
parent 0dce6a98a9
commit dece2776fe
5 changed files with 81 additions and 59 deletions
+4 -8
View File
@@ -1,5 +1,6 @@
import { AstalIO, execAsync, Gio, GObject, property, register, signal, timeout } from "astal";
import AstalNotifd from "gi://AstalNotifd";
import { Config } from "./config";
export interface HistoryNotification {
@@ -23,11 +24,6 @@ class Notifications extends GObject.Object {
#connections: Array<number> = [];
#historyLimit: number = 10;
public static NOTIFICATION_TIMEOUT_CRITICAL: number = 0;
public static NOTIFICATION_TIMEOUT_NORMAL: number = 6000;
public static NOTIFICATION_TIMEOUT_LOW: number = 4000;
@property()
public get notifications() { return this.#notifications };
@@ -65,9 +61,9 @@ class Notifications extends GObject.Object {
this.#connections.push(
AstalNotifd.get_default().connect("notified", (notifd, id) => {
const notification = notifd.get_notification(id);
const notifTimeout = Notifications[`NOTIFICATION_TIMEOUT_${
this.getUrgencyString(notification.urgency).toUpperCase()
}` as keyof typeof Notifications] as number;
const notifTimeout = Config.getDefault().getProperty(
`notifications.timeout_${this.getUrgencyString(notification.urgency).toLowerCase()}`,
"number") as number;
if(this.getNotifd().dontDisturb) {
this.addHistory(notification, () => notification.dismiss());