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" "listen/network"
) )
(deflisten notifications
:initial '{}'
"swaync-client --subscribe"
)
(defvar battery-icon '{ (defvar battery-icon '{
"unknown": "", "unknown": "",
"critical": "", "critical": "",
@ -43,6 +48,12 @@
"tethering": "󰕓" "tethering": "󰕓"
}') }')
(defvar notifications-icon '{
"nothing": "󰂚",
"new": "󱅫",
"dnd": "󰂛"
}')
(defwidget workspaces [] (defwidget workspaces []
(eventbox :onscroll "action/hyprland/nearby-workspace {}" (eventbox :onscroll "action/hyprland/nearby-workspace {}"
(box :class "workspaces" (box :class "workspaces"
@ -75,7 +86,24 @@
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}" "${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 sound [] "")
(defwidget network [] (defwidget network []
"${ "${
network.state == "wireless" network.state == "wireless"
@ -118,7 +146,9 @@
:space-evenly false :space-evenly false
:class "middle" :class "middle"
(tray) (time) (tray)
(time)
(notifications)
) )
(box (box
:halign "end" :halign "end"