From f38ca5a4410c78c39abd76f70ead878a894810af Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Wed, 22 Oct 2025 23:39:54 +0200 Subject: [PATCH] Adds more visual hour notify --- .config/eww/eww.scss | 4 ++ .config/eww/eww.yuck | 1 + .config/eww/widgets/hour-notify/widget.yuck | 46 +++++++++++++++++++++ .config/scripts/NotifyHour.sh | 44 ++------------------ 4 files changed, 54 insertions(+), 41 deletions(-) create mode 100644 .config/eww/widgets/hour-notify/widget.yuck diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss index 5989924..8f5c872 100644 --- a/.config/eww/eww.scss +++ b/.config/eww/eww.scss @@ -11,6 +11,10 @@ background: $background; border-radius: $border-radius; border: 1px solid $border-color; + + &.default-padding { + padding: 1rem; + } } @import "./widgets/media/style.scss" diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index c220bc5..e2a2ef6 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -1 +1,2 @@ (include "./widgets/media/media.yuck") +(include "./widgets/hour-notify/widget.yuck") diff --git a/.config/eww/widgets/hour-notify/widget.yuck b/.config/eww/widgets/hour-notify/widget.yuck new file mode 100644 index 0000000..3a3e850 --- /dev/null +++ b/.config/eww/widgets/hour-notify/widget.yuck @@ -0,0 +1,46 @@ +(defpoll hour-time :interval '1s' :initial '0' `date +"%H"`) + +(defwidget hour-notify [] + (eventbox + :onclick "${EWW_CMD} close hour" + (box + :class "widget default-padding" + :height 150 + :width 150 + :orientation "v" + :space-evenly false + (image + :visible {hour-time <= 6 || hour-time > 22} + :icon "time_moon" + ) + (image + :visible {hour-time > 6 && hour-time <= 10} + :icon "time_moon_to_sun" + ) + (image + :visible {hour-time > 10 && hour-time <= 18} + :icon "time_sun" + ) + (image + :visible {hour-time > 18 && hour-time <= 22} + :icon "time_sun_to_moon" + ) + (label + :text "Now: ${hour-time}:00" + ) + ) + ) + +) + +(defwindow hour + :monitor 1 + :geometry (geometry + :x "0" + :y "50px" + :width "50px" + :height "50px" + :anchor "top center") + :stacking "fg" + (hour-notify) + ) diff --git a/.config/scripts/NotifyHour.sh b/.config/scripts/NotifyHour.sh index f3a2ef8..1176bbd 100755 --- a/.config/scripts/NotifyHour.sh +++ b/.config/scripts/NotifyHour.sh @@ -1,44 +1,6 @@ #!/bin/env sh -ICON_PATH="$HOME/.local/share/icons/hicolor/512x512/apps" +eww open hour -ICON_MAP=( - 0 6 ${ICON_PATH}/time_moon.png - 6 10 ${ICON_PATH}/time_moon_to_sun.png - 10 18 ${ICON_PATH}/time_sun.png - 18 22 ${ICON_PATH}/time_sun_to_moon.png - 22 24 ${ICON_PATH}/time_moon.png -) - -HOUR=$(date +"%H") - -while [[ $# -gt 0 ]]; do - case $1 in - --time) - HOUR="$2" - shift # past argument - shift # past value - ;; - esac -done - -icon="amarok_clock" -length=${#ICON_MAP[@]} -for (( i=0; i