(defvar reveal_scratchpad false) (defwidget scratchpad [] (revealer-on-hover :class "${reveal_scratchpad} scratchpad" :revealvar reveal_scratchpad :revealvar-name "reveal_scratchpad" (label :class "revealer-preview" :tooltip "${jq(scratchpadArray,'.[] | "\\(.title) (\\(.name)) \\n"','r')}" :text " ${jq(scratchpadArray,'. | length')} ${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", "visible": "false"}]}" '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}] scratchpad show' :class "${(entry.visible == 'true') ? 'active' : 'inactive'}" :tooltip "${entry.name}\n${entry.title}" (image :path {entry.icon} :image-width 20 :image-height 20) ))))