From 52fec5e9eea03ccb33285c243466c0b91dfebd22 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Thu, 30 May 2024 15:18:21 +0200 Subject: [PATCH] config/eww ahrc-laptop : ajout widget notifications --- config/eww-ahrc--laptop/eww.yuck | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/config/eww-ahrc--laptop/eww.yuck b/config/eww-ahrc--laptop/eww.yuck index a1a618c..caae745 100644 --- a/config/eww-ahrc--laptop/eww.yuck +++ b/config/eww-ahrc--laptop/eww.yuck @@ -23,6 +23,11 @@ "listen/network" ) +(deflisten notifications + :initial '{}' + "swaync-client --subscribe" +) + (defvar battery-icon '{ "unknown": "", "critical": "", @@ -43,6 +48,12 @@ "tethering": "󰕓" }') +(defvar notifications-icon '{ + "nothing": "󰂚", + "new": "󱅫", + "dnd": "󰂛" +}') + (defwidget workspaces [] (eventbox :onscroll "action/hyprland/nearby-workspace {}" (box :class "workspaces" @@ -75,7 +86,24 @@ "${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}" ) +(defwidget notifications [] + (box (eventbox + :class "module" + :onclick 'swaync-client --toggle-panel' + :onrightclick 'swaync-client --toggle-dnd' + + "${ + notifications.dnd == true + ? notifications-icon["dnd"] + : notifications.count > 0 + ? notifications-icon["new"] + : notifications-icon["nothing"] + } ${notifications.count}" + )) +) + ; (defwidget sound [] "") + (defwidget network [] "${ network.state == "wireless" @@ -118,7 +146,9 @@ :space-evenly false :class "middle" - (tray) (time) + (tray) + (time) + (notifications) ) (box :halign "end"