
(defwindow notifications
    :geometry (geometry :x "0px"
                        :y "0px"
                        :width "1px"
                        :height "63%"
                        :anchor "bottom right")
    :stacking "fg"
    :monitor "0"
(notif-panel))

(defwidget notif-panel [] 
	(eventbox 
	    :halign "start" 
	    :onhoverlost "${EWW_CMD} update rightside=false"
		(revealer 
		    :transition "slideleft"
		    :reveal rightside 
		    :duration "250ms"
		(rightside))))
(defvar rightside false)

(defwidget rightside [] 
    (box
        :class "side" 
        :orientation "v" 
        :space-evenly "false" 
        :spacing "10"
        :halign "center"
        (box
            :class "notification-header"
            :orientation "h" 
            :space-evenly "false" 
            (label
                :class "notification-label"
                :halign "start"
                :text "Notifications")
            (box
                :orientation "h" 
                :space-evenly "false" 
                :halign "end"
                (button
                    :class "notification-action"
                    :tooltip "Refresh"
                    :onclick "dunstctl history > /tmp/dunst-history.json" "")
                (button
                    :class "notification-action"
                    :tooltip "Pause/Resume Notifications"
                    :onclick "dunstctl set-paused toggle" "")
                (button
                    :class "notification-action"
                    :tooltip "Dismiss All"
                    :onclick "pkill dunst && hyprctl dispatch exec dunst && dunstctl history > /tmp/dunst-history.json" "")))
        (scroll
            :vscroll "true"
            :hscroll "false"
            :height 740
            :width 200
            (literal
                :content notifications)
)))

(deflisten notifications "scripts/notifications")
