@@ -8,23 +8,39 @@ use anyhow::{Context, Result};
8
8
use pulsar_core:: {
9
9
event:: Threat ,
10
10
pdk:: {
11
- CleanExit , ConfigError , Event , ModuleConfig , ModuleContext , ModuleError , PulsarModule ,
12
- ShutdownSignal , Version ,
11
+ CleanExit , ConfigError , Event , ModuleConfig , ModuleContext , ModuleDetails , ModuleError ,
12
+ ModuleName , PulsarModule , ShutdownSignal , Version ,
13
13
} ,
14
14
} ;
15
15
16
16
const MODULE_NAME : & str = "desktop-notifier" ;
17
17
18
- pub fn module ( ) -> PulsarModule {
19
- PulsarModule :: new (
20
- MODULE_NAME ,
21
- Version :: parse ( env ! ( "CARGO_PKG_VERSION" ) ) . unwrap ( ) ,
22
- false ,
23
- desktop_nitifier_task,
24
- )
18
+ pub struct DesktopNotifierModule ;
19
+
20
+ impl PulsarModule for DesktopNotifierModule {
21
+ const DEFAULT_ENABLED : bool = false ;
22
+
23
+ fn name ( & self ) -> ModuleName {
24
+ MODULE_NAME . into ( )
25
+ }
26
+
27
+ fn details ( & self ) -> ModuleDetails {
28
+ ModuleDetails {
29
+ version : Version :: parse ( env ! ( "CARGO_PKG_VERSION" ) ) . unwrap ( ) ,
30
+ enabled_by_default : Self :: DEFAULT_ENABLED ,
31
+ }
32
+ }
33
+
34
+ fn start (
35
+ & self ,
36
+ ctx : ModuleContext ,
37
+ shutdown : ShutdownSignal ,
38
+ ) -> impl std:: future:: Future < Output = Result < CleanExit , ModuleError > > + Send + ' static {
39
+ desktop_notifier_task ( ctx, shutdown)
40
+ }
25
41
}
26
42
27
- async fn desktop_nitifier_task (
43
+ async fn desktop_notifier_task (
28
44
ctx : ModuleContext ,
29
45
mut shutdown : ShutdownSignal ,
30
46
) -> Result < CleanExit , ModuleError > {
0 commit comments