(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')}))) ; (box :class "${reveal_scratchpad} scratchpad revealer-on-hover" :orientation "h" :space-evenly false (eventbox :onhover "${EWW_CMD} update reveal_scratchpad=true" :onhoverlost "${EWW_CMD} update reveal_scratchpad=false" (box :space-evenly false ; (children :nth 0) (label :class "revealer-preview" :tooltip "${jq(sway_info,'.scratchpad_info[] | "\\(.title) (\\(.name)) \\n"','r')}" :text " ${jq(sway_info,'.scratchpad_info | length')} ${reveal_scratchpad ? '' : ''}") (revealer :reveal reveal_scratchpad :transition "slideright" :duration "500ms" (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) ))))