pointfichiers/bar/eww/timer/widget.yuck

50 lines
1.2 KiB
Text
Raw Normal View History

(deflisten timer_state :initial '{"pid": 0, "state": "inactive", "time": "00:00", "progress": 100000}' "~/.config/eww/scripts/timer")
2024-02-07 15:53:39 +01:00
(defwidget start-button []
(button
:class "start-button"
:vexpand true
:onclick "kill -10 ${timer_state.pid}"
2024-02-07 15:53:39 +01:00
(overlay
(circular-progress
:class "circle-progress"
:value "${timer_state.progress / 1000}"
2024-02-07 15:53:39 +01:00
:thickness 6
:start-at 75
2024-02-07 15:53:39 +01:00
:clockwise true)
(label :class "start-icon" :text "${timer_state.state == "inactive" ? 'Start' : (timer_state.state == "work" ? "Working" : "Pause")}")
2024-02-07 15:53:39 +01:00
)
)
)
(defwidget timer []
(box
:orientation "v"
:space-evenly false
:class "timer ${timer_state.state}"
2024-02-07 15:53:39 +01:00
(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}")
2024-02-07 15:53:39 +01:00
)
)
)
(defwindow timer
:namespace "eww.timer"
:monitor 0
:geometry (geometry
:x "128px"
:y "128px"
2024-02-07 15:53:39 +01:00
:width "300px"
:height "350px"
:anchor "top left")
:stacking "bg"
:focusable false
:exclusive true
(timer)
)