eww icon indicating copy to clipboard operation
eww copied to clipboard

[BUG] Custom widget using children crashes (used within another custom widget)

Open daxnv opened this issue 2 years ago • 0 comments

Checklist before submitting an issue

  • [X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • [X] I have specifically verified that this bug is not a common user error
  • [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

This is what I could break the bug down to so far. Look at the widget "switch" in the example config below. Initially the window "frame" is showing "v" and "s" like expected. eww update x=false shows "a" and "b". However after eww update x=false, only the "s" appears again, "v" is not visible anymore. Changing back and forth works fine for "a", "b" and "s", only "v" has crashed somehow.

Stumbled over it trying to define a widget for battery and volume status icons, like these for example: (defwidget baticon [] (switch :on charging (map :percentage capacity :values 11 "󰂎" "󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂄") (map :percentage capacity :values 11 "󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"))) (defwidget volicon [] (switch :on muted "󰝟" (map :percentage volume :values 4 "󰕿" "󰖀" "󰕾" "󰕾")))

May be linked to #771

Reproducing the issue

(defwidget switch [on] (box (children :nth {on ? 0 : 1})))
(defwidget varbox [] (box (children :nth 0)))
(defwidget staticbox [] (box "s"))
(defvar x true)

(defwindow frame :geometry (geometry :anchor "center center" :x 0 :y 0 :height 100 :width 100)
  (box
    (switch :on x (varbox "v") (box "a"))
    (switch :on x (staticbox) (box "b"))))

Expected behaviour

No response

Additional context

No response

daxnv avatar Sep 07 '23 15:09 daxnv