pointfichiers/bar/eww/notification/widget.yuck

79 lines
2.1 KiB
Text
Raw Permalink Normal View History

(defvar close_icon "/home/gaspard/.config/eww/assets/icons/window-close.svg")
2024-06-22 21:16:35 +02:00
(defvar end-binary "end-rs")
(defvar end-notifications '')
(defvar end-histories '')
(defvar end-replies '')
(defvar end-reply-text '')
2024-06-22 21:16:35 +02:00
(defwidget notification[notification]
2024-06-22 21:16:35 +02:00
(box
:class "notification"
:space-evenly false
:orientation "v"
:spacing 6
(box :orientation "h" :spacing 8 :space-evenly false
(box
:class "${(notification.app_icon ?: "") != "" ? "notification-app-icon" : ""}"
:style "background-image: url('${notification.app_icon}');"
)
2024-06-22 21:16:35 +02:00
(label
:text "${notification.application}"
2024-06-22 21:16:35 +02:00
:halign "start"
:hexpand true)
(button :onclick "${end-binary} close ${notification.id}"
2024-06-22 21:16:35 +02:00
(image
:path "${close_icon}"
:image-width 24
:image-height 24)
)
)
(box :orientation "h" :space-evenly false :spacing 8
(box
:class "${notification.icon != "" ? "notification-icon" : ""}"
:style "background-image: url('${notification.icon}');"
2024-06-22 21:16:35 +02:00
)
(box
:class "notification-text-container"
:orientation "v"
:hexpand true
:space-evenly false
(label
:class "notification-summary"
:text "${notification.summary}"
2024-06-22 21:16:35 +02:00
:halign "start")
(label
:text "${notification.body}"
2024-06-22 21:16:35 +02:00
:wrap true
:halign "fill"
:vexpand true)
(box
:class "notification-buttons"
:orientation "horizontal"
:space-evenly false
:halign "end"
:vexpand false
(for action in {notification.actions}
(button
:class "notification-button"
:onclick "${end-binary} action ${notification.id} ${action.id}"
:vexpand false
{action.text}))
)
2024-06-22 21:16:35 +02:00
)
)
)
)
(defwindow notification_overlay
:namespace "eww.notification_overlay"
:monitor 0
:geometry (geometry
:width "400px"
:anchor "bottom right")
:stacking "overlay"
:focusable false
:exclusive true
(literal :content end-notifications)
2024-06-22 21:16:35 +02:00
)