(deflisten timer_state :initial '{"pid": 0, "state": "inactive", "time": "00:00", "progress": 100000}' "~/.config/eww/scripts/timer") (defwidget start-button [] (button :class "start-button" :vexpand true :onclick "kill -10 ${timer_state.pid}" (overlay (circular-progress :class "circle-progress" :value "${timer_state.progress / 1000}" :thickness 6 :start-at 75 :clockwise true) (label :class "start-icon" :text "${timer_state.state == "inactive" ? 'Start' : (timer_state.state == "work" ? "Working" : "Pause")}") ) ) ) (defwidget timer [] (box :orientation "v" :space-evenly false :class "timer ${timer_state.state}" (label :class "timer-title" :text "Grind timer") (start-button :valign "center" :vexpand true) (revealer :transition "slideup" :reveal {timer_state.state != "inactive"} (label :class "timer-text" :text "${timer_state.time}") ) ) ) (defwindow timer :namespace "eww.timer" :monitor 0 :geometry (geometry :x "128px" :y "128px" :width "300px" :height "350px" :anchor "top left") :stacking "bg" :focusable false :exclusive true (timer) )