Added urgency functionality when events are present

This commit is contained in:
Nox Sluijtman 2024-03-20 01:30:27 +01:00
parent cbf2c59da0
commit fd30000380

View file

@ -38,8 +38,11 @@ def get_batteries [] {
} }
# Documentation for notify # Documentation for notify
def notify [message: string] { def notify [message: string, urgent: bool] {
notify-send "Status" $message match $urgent {
true => (notify-send "Status" $message -u critical)
false => (notify-send "Status" $message)
}
} }
def calendar [hours: int] { def calendar [hours: int] {
@ -52,15 +55,14 @@ def calendar [hours: int] {
} }
# Documentation for construct_string # Documentation for construct_string
def construct_string [] {
[ $dateString
$discordianDate
(calendar 2)
(get_batteries)
] | str join "\n\n"
}
# Documentation for main
def main [] { def main [] {
notify (construct_string) let calendar_status = calendar 2
let urgent = not ($calendar_status | str starts-with "No events")
notify (
[ $dateString
$discordianDate
$calendar_status
(get_batteries)
] | str join "\n\n"
) $urgent
} }