;; -*-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 -5 :space-evenly true :class "special" "${formattime(clock--data.stamp, '%H', clock--data.tz)}" ":" "${formattime(clock--data.stamp, '%M', clock--data.tz)}" ":" "${formattime(clock--data.stamp, '%S', clock--data.tz)}" ) (label :text {formattime(clock--data.stamp, "%Y-%m-%d", clock--data.tz)}))) (defwidget mission-clock [] (box :class "module text" :spacing 0 :orientation "v" :halign "center" :valign "center" :visible {clock--data.timer.active} (box :orientation "h" :space-evenly false :spacing 5 :valign "center" :halign "center" (label :text 'T' :class "special") (label :text {clock--data.timer.started ? "+" : "-"} :class {clock--data.timer.started ? "green" : "highlight"}) (label :text {clock--data.timer.timer} :class "special")) (label :text '${clock--data.timer.title} ${clock--data.timer.prefix}'))) (defwidget big-clock [] (centerbox :class "bigger nebula" :space-evenly false :halign "center" :valign "center" :width 100 :orientation "h" (box :halign "start" {formattime(clock--data.stamp, "%H", clock--data.tz)}) (box :halign "center" ":") (box :halign "end" {formattime(clock--data.stamp, "%M", clock--data.tz)}))) (defwidget date [] (box :class "nebula module text" :space-evenly false :spacing 20 :halign "start" :valign "center" :orientation "h" (label :text {formattime(clock--data.stamp, "%A", clock--data.tz)} :class "medium" :valign "center") (label :text {formattime(clock--data.stamp, "%B %d", clock--data.tz)} :class "special" :valign "center"))) (defwidget side-mission-clock [] (box :class "module text" :space-evenly false :spacing 5 :halign "start" :valign "center" :visible {clock--data.timer.active} :width 200 :orientation "v" (label :class "big nebula special" :text {clock--data.timer.title}) (label :class "nebula" :text {clock--data.timer.prefix}) (box :class "nebula" :spacing 5 :halign "center" :space-evenly false (label :text "T") (label :class {clock--data.timer.started ? "green" : "highlight"} :text {clock--data.timer.started ? "+" : "-"}) (label :class "nebula" :text {clock--data.timer.timer})))) (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" :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.stamp, "%H", clock--data.tz)}) (box :halign "center" ":") (box :halign "end" {formattime(clock--data.stamp, "%M", clock--data.tz)})) (label :text {formattime(clock--data.stamp, "%A", clock--data.tz)} :class "special nebula") (label :text {formattime(clock--data.stamp, "%B %d", clock--data.tz)} :class "nebula") (label :text {clock--data.tz} :class "highlight timezone" :visible {clock--data.tz-source != "system"}) ) (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" )))))))