From d5255078d0a8280994a6c153024049d7cff38862 Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Sat, 12 Sep 2026 18:29:14 -0400 Subject: [PATCH] Add do not disturb toggle and bar indicator --- modules/home/ags/app/widget/Notifications.tsx | 29 ++++++++++++++++++- modules/home/ags/app/widget/QuickSettings.tsx | 5 ++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/modules/home/ags/app/widget/Notifications.tsx b/modules/home/ags/app/widget/Notifications.tsx index 2f4b240..e4890a5 100644 --- a/modules/home/ags/app/widget/Notifications.tsx +++ b/modules/home/ags/app/widget/Notifications.tsx @@ -1,11 +1,38 @@ import GLib from "gi://GLib" import { App, Astal, Gdk, Gtk } from "astal/gtk3" import Notifd from "gi://AstalNotifd" -import { bind } from "astal" +import { Variable, bind } from "astal" import { MAX_TIMEOUT } from "../notif-config" const notifd = Notifd.get_default() +export const dndIcon = Variable.derive([bind(notifd, "dontDisturb")], (dnd) => + dnd + ? "notifications-disabled-symbolic" + : "preferences-system-notifications-symbolic", +) + +export function DndToggle() { + return ( + + v ? "toggle-button active" : "toggle-button", + )} + > + + + ) +} + notifd.default_timeout = MAX_TIMEOUT // notifications restored from the daemon's cache on startup are stale diff --git a/modules/home/ags/app/widget/QuickSettings.tsx b/modules/home/ags/app/widget/QuickSettings.tsx index 8c934e1..80c883f 100644 --- a/modules/home/ags/app/widget/QuickSettings.tsx +++ b/modules/home/ags/app/widget/QuickSettings.tsx @@ -9,7 +9,7 @@ import { bluetoothIndicator, BluetoothSection } from "./Bluetooth" import { BrightnessRow } from "./Brightness" import { MediaSection } from "./Media" import { batteryIcon, batteryPercent, BatterySection } from "./Battery" -import { NotificationCard } from "./Notifications" +import { NotificationCard, DndToggle, dndIcon } from "./Notifications" const speaker = AstalWp.get_default().audio.default_speaker! const mic = AstalWp.get_default().audio.default_microphone @@ -83,7 +83,7 @@ export default function QuickSettings(gdkmonitor: Gdk.Monitor) { > - + )} +