Skip to content

Commit 5bb9c55

Browse files
committed
add debounce in notify plugin
1 parent dc0dfdb commit 5bb9c55

File tree

12 files changed

+519
-109
lines changed

12 files changed

+519
-109
lines changed

Cargo.lock

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/notify/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tokio = { workspace = true, features = ["macros"] }
1616

1717
[dependencies]
1818
notify = "8"
19+
notify-debouncer-full = "0.5"
1920

2021
tauri = { workspace = true, features = ["test"] }
2122
tauri-plugin-path2 = { workspace = true }

plugins/notify/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const COMMANDS: &[&str] = &[];
1+
const COMMANDS: &[&str] = &["start", "stop"];
22

33
fn main() {
44
tauri_plugin::Builder::new(COMMANDS).build();

plugins/notify/js/bindings.gen.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,31 @@
66

77

88
export const commands = {
9-
9+
async start() : Promise<Result<null, string>> {
10+
try {
11+
return { status: "ok", data: await TAURI_INVOKE("plugin:notify|start") };
12+
} catch (e) {
13+
if(e instanceof Error) throw e;
14+
else return { status: "error", error: e as any };
15+
}
16+
},
17+
async stop() : Promise<Result<null, string>> {
18+
try {
19+
return { status: "ok", data: await TAURI_INVOKE("plugin:notify|stop") };
20+
} catch (e) {
21+
if(e instanceof Error) throw e;
22+
else return { status: "error", error: e as any };
23+
}
24+
}
1025
}
1126

1227
/** user-defined events **/
1328

1429

1530
export const events = __makeEvents__<{
16-
entityChanged: EntityChanged,
17-
fileChanged: FileChanged,
18-
settingsChanged: SettingsChanged
31+
fileChanged: FileChanged
1932
}>({
20-
entityChanged: "plugin:notify:entity-changed",
21-
fileChanged: "plugin:notify:file-changed",
22-
settingsChanged: "plugin:notify:settings-changed"
33+
fileChanged: "plugin:notify:file-changed"
2334
})
2435

2536
/** user-defined constants **/
@@ -28,11 +39,7 @@ settingsChanged: "plugin:notify:settings-changed"
2839

2940
/** user-defined types **/
3041

31-
export type ChangeAction = "created" | "updated" | "deleted"
32-
export type EntityChanged = { entity_type: EntityType; entity_id: string; action: ChangeAction }
33-
export type EntityType = "session" | "transcript" | "human" | "organization" | "event" | "chat_group" | "chat_message" | "enhanced_note" | "template" | "memory" | "folder" | "tag" | "prompt" | "chat_shortcut"
3442
export type FileChanged = { path: string }
35-
export type SettingsChanged = { path: string }
3643

3744
/** tauri-specta globals **/
3845

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
"$schema" = "../../schemas/schema.json"
4+
5+
[[permission]]
6+
identifier = "allow-start"
7+
description = "Enables the start command without any pre-configured scope."
8+
commands.allow = ["start"]
9+
10+
[[permission]]
11+
identifier = "deny-start"
12+
description = "Denies the start command without any pre-configured scope."
13+
commands.deny = ["start"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
"$schema" = "../../schemas/schema.json"
4+
5+
[[permission]]
6+
identifier = "allow-stop"
7+
description = "Enables the stop command without any pre-configured scope."
8+
commands.allow = ["stop"]
9+
10+
[[permission]]
11+
identifier = "deny-stop"
12+
description = "Denies the stop command without any pre-configured scope."
13+
commands.deny = ["stop"]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Permission Table
2+
3+
<table>
4+
<tr>
5+
<th>Identifier</th>
6+
<th>Description</th>
7+
</tr>
8+
9+
10+
<tr>
11+
<td>
12+
13+
`notify:allow-start`
14+
15+
</td>
16+
<td>
17+
18+
Enables the start command without any pre-configured scope.
19+
20+
</td>
21+
</tr>
22+
23+
<tr>
24+
<td>
25+
26+
`notify:deny-start`
27+
28+
</td>
29+
<td>
30+
31+
Denies the start command without any pre-configured scope.
32+
33+
</td>
34+
</tr>
35+
36+
<tr>
37+
<td>
38+
39+
`notify:allow-stop`
40+
41+
</td>
42+
<td>
43+
44+
Enables the stop command without any pre-configured scope.
45+
46+
</td>
47+
</tr>
48+
49+
<tr>
50+
<td>
51+
52+
`notify:deny-stop`
53+
54+
</td>
55+
<td>
56+
57+
Denies the stop command without any pre-configured scope.
58+
59+
</td>
60+
</tr>
61+
</table>

0 commit comments

Comments
 (0)