eww/examples/data-structures/eww.yuck
GallowsDove 2c81b3fbc7
feat: Add support for on-demand window focus on wayland (#1215)
* feat: Add support for on-demand window focus on wayland

* fix: cargo fmt

* Update CHANGELOG.md with OnDemand focusable

* fix: add v0_6 feature to gtk-layer-shell in eww/cargo.toml
2024-12-27 00:44:06 +01:00

73 lines
1.2 KiB
Text

(defvar stringArray `[
"🦝",
"🐱",
"🐵",
"🦁",
"🐹",
"🦊"
]`)
(defvar object `{
"🦝": "racoon",
"🐱": "cat",
"🐵": "ape",
"🦁": "lion",
"🐹": "hamster",
"🦊": "fox"
}`)
; You could also create an array of objects:
; (defvar objectArray `[{ "emoji": "🦝", "name": "racoon" }, { "emoji": "🦊", "name": "fox" }]`)
(defvar selected `🦝`)
(defwidget animalButton [emoji]
(box
:class "animalLayout"
(eventbox
:class `animal ${selected == emoji ? "selected" : ""}`
:cursor "pointer"
:onhover "eww update selected=${emoji}"
emoji
)
)
)
(defwidget animalRow []
(box
:class "animals"
:orientation "horizontal"
:halign "center"
(for animal in stringArray
(animalButton
:emoji animal
)
)
)
)
(defwidget currentAnimal []
(box
`${object[selected]} ${selected}`
)
)
(defwidget layout []
(box
:class "layout"
:orientation "vertical"
:halign "center"
(animalRow)
(currentAnimal)
)
)
(defwindow data-structures
:monitor 0
:exclusive false
:focusable none
:geometry (geometry
:anchor "center"
)
(layout)
)