(defvar reveal_scratchpad false)
(defwidget scratchpad []
  (revealer-on-hover
    :revealvar reveal_scratchpad
    :revealvar-name "reveal_scratchpad"
    ""
    (scratchpad_children :array scratchpadArray)))

(deflisten scratchpadArray :initial "${[{"icon": "/usr/share/icons/breeze-dark/mimetypes/32/unknown.svg", "name": "placeholder", "title": "placeholder", "win_id": "0"}]}"
  'scripts/bar/scratchpad')
(defwidget scratchpad_children [array]
  (box :orientation "h"
       :class "reveal_children"
       :space-evenly false
      (for entry in array
        (button :onclick 'swaymsg [con_id=${entry.win_id}] focus'
                :tooltip "${entry.name}
${entry.title}"
          (image :path {entry.icon}
               :image-width 20
               :image-height 20)
        ))))
