pointfichiers/bar/eww/notification/widget.yuck

78 lines
2.1 KiB
Text

(defvar close_icon "/usr/share/icons/Qogir-ubuntu-dark/16/actions/window-close.svg")
(defvar end-binary "~/.local/bin/end-rs")
(defvar end-notifications '')
(defvar end-histories '')
(defvar end-replies '')
(defvar end-reply-text '')
(defwidget notification[notification]
(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}');"
)
(label
:text "${notification.application}"
:halign "start"
:hexpand true)
(button :onclick "${end-binary} close ${notification.id}"
(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}');"
)
(box
:class "notification-text-container"
:orientation "v"
:hexpand true
:space-evenly false
(label
:class "notification-summary"
:text "${notification.summary}"
:halign "start")
(label
:text "${notification.body}"
: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}))
)
)
)
)
)
(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)
)