dotfiles/de/home/.config/eww/modules/bar/scratchpad.yuck
2025-11-29 11:15:01 -08:00

26 lines
1.1 KiB
Text

(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"}]}"
'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') ? visible : hidden}"
:tooltip "${entry.name}\n${entry.title}"
(image :path {entry.icon}
:image-width 20
:image-height 20)
))))