config/eww ahrc-laptop : ajout widget notifications

This commit is contained in:
Ahurac 2024-05-30 15:18:21 +02:00
parent d9c824ddff
commit 52fec5e9ee

View file

@ -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"