Added urgency functionality when events are present
This commit is contained in:
parent
cbf2c59da0
commit
fd30000380
|
@ -38,8 +38,11 @@ def get_batteries [] {
|
|||
}
|
||||
|
||||
# Documentation for notify
|
||||
def notify [message: string] {
|
||||
notify-send "Status" $message
|
||||
def notify [message: string, urgent: bool] {
|
||||
match $urgent {
|
||||
true => (notify-send "Status" $message -u critical)
|
||||
false => (notify-send "Status" $message)
|
||||
}
|
||||
}
|
||||
|
||||
def calendar [hours: int] {
|
||||
|
@ -52,15 +55,14 @@ def calendar [hours: int] {
|
|||
}
|
||||
|
||||
# Documentation for construct_string
|
||||
def construct_string [] {
|
||||
def main [] {
|
||||
let calendar_status = calendar 2
|
||||
let urgent = not ($calendar_status | str starts-with "No events")
|
||||
notify (
|
||||
[ $dateString
|
||||
$discordianDate
|
||||
(calendar 2)
|
||||
$calendar_status
|
||||
(get_batteries)
|
||||
] | str join "\n\n"
|
||||
}
|
||||
|
||||
# Documentation for main
|
||||
def main [] {
|
||||
notify (construct_string)
|
||||
) $urgent
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue