landscape/desk/app/growl.hoon

71 lines
1.7 KiB
Plaintext
Raw Normal View History

2023-04-25 01:41:14 +03:00
/- hark
/+ summarize, default-agent, verb, dbug
2023-04-17 18:18:41 +03:00
::
|%
+$ card card:agent:gall
+$ versioned-state
$% state-0
==
2023-04-25 01:41:14 +03:00
+$ state-0 [%0 enabled=? bark-host=ship]
2023-04-17 18:18:41 +03:00
--
::
:: This agent should eventually go into landscape
::
=| state-0
=* state -
%- agent:dbug
%+ verb |
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %.n) bowl)
++ on-init
:_ this(enabled %.n)
~[[%pass /hark %agent [our.bowl %hark] %watch /ui]]
++ on-poke
|= [=mark =vase]
^- (quip card _this)
?+ mark (on-poke:def mark vase)
2023-04-25 01:41:14 +03:00
%set-host
?> =(src.bowl our.bowl)
`this(bark-host !<(ship vase))
::
2023-04-17 18:18:41 +03:00
%enable
2023-04-25 01:41:14 +03:00
:_ this(enabled %.y)
~[[%pass /add-recipient %agent [bark-host %bark] %poke %bark-add-recipient !>(our.bowl)]]
::
2023-04-17 18:18:41 +03:00
%disable
2023-04-25 01:41:14 +03:00
:_ this(enabled %.n)
~[[%pass /remove-recipient %agent [bark-host %bark] %poke %bark-remove-recipient !>(our.bowl)]]
::
%growl-summarize
?. enabled
2023-04-17 18:18:41 +03:00
:_ this
2023-04-25 01:41:14 +03:00
~[[%pass /bark-summary %agent [bark-host %bark] %poke %bark-receive-summary !>(~)]]
=/ requested !<(time vase)
=/ activity ~(summarize-activity summarize [our now]:bowl)
=/ inactivity ~(summarize-inactivity summarize [our now]:bowl)
2023-04-25 01:41:14 +03:00
:_ this
~[[%pass /bark-summary %agent [bark-host %bark] %poke %bark-receive-summary !>(`[requested %life activity inactivity])]]
2023-04-17 18:18:41 +03:00
==
2023-04-25 01:41:14 +03:00
++ on-watch on-watch:def
++ on-agent on-agent:def
2023-04-17 18:18:41 +03:00
++ on-fail
|= [=term =tang]
(mean ':sub +on-fail' term tang)
++ on-leave
|= =path
`this
++ on-save !>(state)
++ on-load
|= old-state=vase
^- (quip card _this)
=/ old !<(versioned-state old-state)
?- -.old
%0
`this(state old)
==
++ on-arvo on-arvo:def
++ on-peek on-peek:def
--