Adds more visual hour notify
This commit is contained in:
parent
fcda0d328b
commit
f38ca5a441
4 changed files with 54 additions and 41 deletions
|
|
@ -11,6 +11,10 @@
|
|||
background: $background;
|
||||
border-radius: $border-radius;
|
||||
border: 1px solid $border-color;
|
||||
|
||||
&.default-padding {
|
||||
padding: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
@import "./widgets/media/style.scss"
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
(include "./widgets/media/media.yuck")
|
||||
(include "./widgets/hour-notify/widget.yuck")
|
||||
|
|
|
|||
46
.config/eww/widgets/hour-notify/widget.yuck
Normal file
46
.config/eww/widgets/hour-notify/widget.yuck
Normal file
|
|
@ -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)
|
||||
)
|
||||
|
|
@ -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<length; i += 3 ));
|
||||
do
|
||||
if [[ $HOUR -lt ${ICON_MAP[$i]} ]] then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ $HOUR -ge "${ICON_MAP[$i+1]}" ]] then
|
||||
continue
|
||||
fi
|
||||
|
||||
icon="${ICON_MAP[$i+2]}"
|
||||
break
|
||||
done
|
||||
|
||||
notify-send --icon "${icon}" \
|
||||
--app-name="Current Hour" \
|
||||
"Ding Dong..." \
|
||||
"It's currently: ${HOUR}:00"
|
||||
sleep 10
|
||||
eww close hour
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue