68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
(defpoll clock--data :interval "500ms"
|
|
`date +'{"hour": "%H", "minute": "%M", "second": "%S", "year": "%Y", "day": "%d", "month": "%m", "dow": "%A", "month_name": "%B", "unix": "%s"}'`)
|
|
|
|
(defvar clock--show "clock")
|
|
|
|
(defwidget clock []
|
|
(box :class "module text"
|
|
:spacing 0
|
|
:orientation "v"
|
|
(label :class "special"
|
|
:text "${clock--data['hour']}:${clock--data['minute']}")
|
|
(label :text "${clock--data['year']}-${clock--data['month']}-${clock--data['day']}")))
|
|
|
|
(defwidget sideclock []
|
|
(button :onclick "echo -n $(date +%Y-%d-%m) | wl-copy"
|
|
:onrightclick "echo -n $(date +%s) | wl-copy && eww update clock--show=unixtime && sleep 2 && eww update clock--show=clock"
|
|
(overlay
|
|
(box :class "module text nebula"
|
|
:spacing 0
|
|
:space-evenly false
|
|
:orientation "v"
|
|
(centerbox :class "bigger nebula"
|
|
:space-evenly false
|
|
:width 150
|
|
:halign "center"
|
|
:orientation "h"
|
|
(box :halign "start" "${clock--data.hour}")
|
|
(box :halign "center" ":")
|
|
(box :halign "end" "${clock--data.minute}"))
|
|
(label :text "${clock--data.dow}"
|
|
:class "special")
|
|
(label :text "${clock--data.month_name} ${clock--data.day}"))
|
|
(box
|
|
:height 100
|
|
(revealer :transition "crossfade"
|
|
:reveal {clock--show == "unixtime"}
|
|
:duration {clock--show == "unixtime" ? "2s" : "500ms"}
|
|
(box :width 200
|
|
:height 50
|
|
:class "message-overlay nebula special"
|
|
(box
|
|
:space-evenly false
|
|
:spacing 0
|
|
:halign "center"
|
|
:valign "center"
|
|
:orientation "v"
|
|
"Copied UNIX"
|
|
"timestamp"
|
|
))))
|
|
(box
|
|
:height 100
|
|
(revealer :transition "crossfade"
|
|
:reveal {clock--show == "date"}
|
|
:duration {clock--show == "date" ? "2s" : "500ms"}
|
|
(box :width 200
|
|
:height 50
|
|
:class "message-overlay nebula special"
|
|
(box
|
|
:space-evenly false
|
|
:spacing 0
|
|
:halign "center"
|
|
:valign "center"
|
|
:orientation "v"
|
|
"Copied"
|
|
"current date"
|
|
|
|
)))))))
|