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
+9 -1
View File
@@ -1,4 +1,4 @@
import { AstalIO, execAsync, GObject, interval, property, register } from "astal";
import { AstalIO, exec, execAsync, GLib, GObject, interval, property, register } from "astal";
export { NightLight };
@@ -134,4 +134,12 @@ class NightLight extends GObject.Object {
this.#prevTemperature = null;
this.#prevGamma = null;
}
public saveData(): void {
exec(`sh ${GLib.get_user_config_dir()}/hypr/scripts/save-hyprsunset.sh`);
}
public loadData(): void {
exec(`sh ${GLib.get_user_config_dir()}/hypr/scripts/load-hyprsunset.sh`);
}
}
+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());