106 lines
3.4 KiB
Common Lisp
106 lines
3.4 KiB
Common Lisp
;; -*-lisp-*-
|
|
(deflisten clock--data :initial "{}"
|
|
`~/.config/eww/scripts/date.py`)
|
|
|
|
(defvar clock--show "clock")
|
|
|
|
(defwidget clock []
|
|
(box :class "module text"
|
|
:spacing 0
|
|
:orientation "v"
|
|
(box :orientation "h"
|
|
:spacing -20
|
|
:space-evenly true
|
|
:class "special"
|
|
"${formattime(clock--data, '%H')}"
|
|
":"
|
|
"${formattime(clock--data, '%M')}"
|
|
":"
|
|
"${formattime(clock--data, '%S')}"
|
|
)
|
|
(label :text {formattime(clock--data, "%Y-%m-%d")})))
|
|
|
|
|
|
(defwidget big-clock []
|
|
(centerbox :class "bigger nebula"
|
|
:space-evenly false
|
|
:halign "center"
|
|
:valign "center"
|
|
:width 100
|
|
:orientation "h"
|
|
(box :halign "start" {formattime(clock--data, "%H")})
|
|
(box :halign "center" ":")
|
|
(box :halign "end" {formattime(clock--data, "%M")})))
|
|
|
|
|
|
(defwidget date []
|
|
(box :class "nebula module text"
|
|
:space-evenly false
|
|
:spacing 20
|
|
:halign "start"
|
|
:valign "center"
|
|
:orientation "h"
|
|
(label :text {formattime(clock--data, "%A")}
|
|
:class "medium"
|
|
:valign "center")
|
|
(label :text {formattime(clock--data, "%B %d")}
|
|
:class "special"
|
|
:valign "center")))
|
|
|
|
|
|
|
|
(defwidget sideclock []
|
|
(button :onclick "echo -n $(date +%Y-%d-%m) | wl-copy && eww update clock--show=date && sleep 2 && eww update clock--show=clock"
|
|
: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" {formattime(clock--data, "%H")})
|
|
(box :halign "center" ":")
|
|
(box :halign "end" {formattime(clock--data, "%M")}))
|
|
(label :text {formattime(clock--data, "%A")}
|
|
:class "special")
|
|
(label :text {formattime(clock--data, "%B %d")}))
|
|
(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"
|
|
|
|
)))))))
|