(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(sway_info,'.scratchpad_info[] | "\\(.title) (\\(.name)) \\n"','r')}" :text " ${jq(sway_info,'.scratchpad_info | length')} ${reveal_scratchpad ? '' : ''}") (scratchpad_children :array {jq(sway_info,'.scratchpad_info','r')}))) (defwidget scratchpad_children [array] (box :orientation "h" :class "reveal-children" :space-evenly false (for entry in array (button :onclick 'swaymsg [con_id=${entry.window_id}] scratchpad show' :class "scratchpad-item ${(entry.visible == 'true') ? 'active' : 'inactive'}" :tooltip "${entry.title} ${entry.name}" (image :path {entry.icon} :image-width 20 :image-height 20) ))))