dotfiles/dotconfig/eww/analog_clock/clock.yuck
2024-07-20 22:04:00 +02:00

120 lines
2.4 KiB
Text

(defpoll hours
:interval "1s"
:initial "00"
`date +%I`)
(defpoll minutes
:interval "1s"
:initial "00"
`date +%M`)
(defpoll seconds
:interval "1s"
:initial "00"
`date +%S`)
(defpoll ampm
:interval "1s"
:initial "00"
`date +%p`)
(defpoll date
:interval "1s"
:initial "1970-01-01"
`date +%Y-%m-%d`)
(defwidget clock []
(box :vexpand false :hexpand false
:width 180
:height 180
:space-evenly false
(overlay
(box :width 180 :height 180 :class "analog-clock")
(box
(image :path "/home/primardj/.config/eww/analog_clock/clock_socle.svg" :image-width 170 :image-height 170)
)
;(transform
; :rotate "${4*100/60}" ;"${minutes*100/60}"
; :translate-x "0%"
; :translate-y "0%"
; (image :path "/home/primardj/.config/eww/analog_clock/clock_big_tic.svg" :image-width 170 :image-height 170)
;)
;(transform
; :rotate "${(1+4/60)*100/12}" ; "${(hours+minutes/60)*100/12}"
; (image :path "/home/primardj/.config/eww/analog_clock/clock_little_tic.svg" :image-width 170 :image-height 170)
;)
(transform
:translate-x "22%"
:translate-y "22%"
:scale-x "70%"
:scale-y "70%"
(circular-progress
:class "analog-minutes"
:thickness 10
:start-at 75
:value "${minutes*100/60}"
)
)
(transform
:translate-x "34%"
:translate-y "34%"
:scale-x "60%"
:scale-y "60%"
(circular-progress
:class "analog-hours"
:thickness 10
:start-at 75
:value "${(hours+minutes/60)*100/12}"
)
)
)
(box
:height 180
:width 180
:class "numerical-clock"
:orientation "v"
:space-evenly false
(box
:class "time-container"
(box
:class "time"
(label :text hours)
)
(box
:class "time"
(label :text minutes)
)
(box
:class "time"
(label :text ampm)
)
)
(box
:class "date"
(label :text " ${date}")
)
)
))
(defwindow clock
:monitor 0
:geometry (geometry
:x "8.5%"
:y "58%"
:height "200px"
:anchor "top right")
:stacking "bg"
:exclusive true
:focusable false
:namespaces "widget_clock"
(clock))