Commit 0c52375e06

0c52375e0617d5624f8c92db4226c5ff57a21bf8

parent: c63f8d98d5

Unregistered key

Benjamin Grosse <ste3ls@gmail.com> · 2024-03-22 00:46 UTC
committer: <noreply@github.com>

Add support for desktop notifications (#192)

Layout: unified · split

Cargo.lock +583 −27
@@ -213,6 +213,16 @@ version = "1.1.1"
213213source = "registry+https://github.com/rust-lang/crates.io-index"
214214checksum = "5f093eed78becd229346bf859eec0aa4dd7ddde0757287b2b4107a1f09c80002"
215215
216[[package]]
217name = "async-broadcast"
218version = "0.5.1"
219source = "registry+https://github.com/rust-lang/crates.io-index"
220checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b"
221dependencies = [
222 "event-listener 2.5.3",
223 "futures-core",
224]
225
216226[[package]]
217227name = "async-channel"
218228version = "2.2.0"
@@ -221,11 +231,142 @@ checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3"
221231dependencies = [
222232 "concurrent-queue",
223233 "event-listener 5.2.0",
224 "event-listener-strategy",
234 "event-listener-strategy 0.5.0",
225235 "futures-core",
226236 "pin-project-lite",
227237]
228238
239[[package]]
240name = "async-executor"
241version = "1.8.0"
242source = "registry+https://github.com/rust-lang/crates.io-index"
243checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c"
244dependencies = [
245 "async-lock 3.3.0",
246 "async-task",
247 "concurrent-queue",
248 "fastrand 2.0.1",
249 "futures-lite 2.3.0",
250 "slab",
251]
252
253[[package]]
254name = "async-fs"
255version = "1.6.0"
256source = "registry+https://github.com/rust-lang/crates.io-index"
257checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06"
258dependencies = [
259 "async-lock 2.8.0",
260 "autocfg",
261 "blocking",
262 "futures-lite 1.13.0",
263]
264
265[[package]]
266name = "async-io"
267version = "1.13.0"
268source = "registry+https://github.com/rust-lang/crates.io-index"
269checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
270dependencies = [
271 "async-lock 2.8.0",
272 "autocfg",
273 "cfg-if",
274 "concurrent-queue",
275 "futures-lite 1.13.0",
276 "log",
277 "parking",
278 "polling 2.8.0",
279 "rustix 0.37.24",
280 "slab",
281 "socket2 0.4.9",
282 "waker-fn",
283]
284
285[[package]]
286name = "async-io"
287version = "2.3.2"
288source = "registry+https://github.com/rust-lang/crates.io-index"
289checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884"
290dependencies = [
291 "async-lock 3.3.0",
292 "cfg-if",
293 "concurrent-queue",
294 "futures-io",
295 "futures-lite 2.3.0",
296 "parking",
297 "polling 3.5.0",
298 "rustix 0.38.32",
299 "slab",
300 "tracing",
301 "windows-sys 0.52.0",
302]
303
304[[package]]
305name = "async-lock"
306version = "2.8.0"
307source = "registry+https://github.com/rust-lang/crates.io-index"
308checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
309dependencies = [
310 "event-listener 2.5.3",
311]
312
313[[package]]
314name = "async-lock"
315version = "3.3.0"
316source = "registry+https://github.com/rust-lang/crates.io-index"
317checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b"
318dependencies = [
319 "event-listener 4.0.3",
320 "event-listener-strategy 0.4.0",
321 "pin-project-lite",
322]
323
324[[package]]
325name = "async-process"
326version = "1.8.1"
327source = "registry+https://github.com/rust-lang/crates.io-index"
328checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88"
329dependencies = [
330 "async-io 1.13.0",
331 "async-lock 2.8.0",
332 "async-signal",
333 "blocking",
334 "cfg-if",
335 "event-listener 3.1.0",
336 "futures-lite 1.13.0",
337 "rustix 0.38.32",
338 "windows-sys 0.48.0",
339]
340
341[[package]]
342name = "async-recursion"
343version = "1.1.0"
344source = "registry+https://github.com/rust-lang/crates.io-index"
345checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5"
346dependencies = [
347 "proc-macro2",
348 "quote",
349 "syn 2.0.52",
350]
351
352[[package]]
353name = "async-signal"
354version = "0.2.5"
355source = "registry+https://github.com/rust-lang/crates.io-index"
356checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5"
357dependencies = [
358 "async-io 2.3.2",
359 "async-lock 2.8.0",
360 "atomic-waker",
361 "cfg-if",
362 "futures-core",
363 "futures-io",
364 "rustix 0.38.32",
365 "signal-hook-registry",
366 "slab",
367 "windows-sys 0.48.0",
368]
369
229370[[package]]
230371name = "async-stream"
231372version = "0.3.5"
@@ -248,6 +389,12 @@ dependencies = [
248389 "syn 2.0.52",
249390]
250391
392[[package]]
393name = "async-task"
394version = "4.7.0"
395source = "registry+https://github.com/rust-lang/crates.io-index"
396checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799"
397
251398[[package]]
252399name = "async-trait"
253400version = "0.1.73"
@@ -259,6 +406,12 @@ dependencies = [
259406 "syn 2.0.52",
260407]
261408
409[[package]]
410name = "atomic-waker"
411version = "1.1.2"
412source = "registry+https://github.com/rust-lang/crates.io-index"
413checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
414
262415[[package]]
263416name = "autocfg"
264417version = "1.1.0"
@@ -391,6 +544,22 @@ dependencies = [
391544 "generic-array",
392545]
393546
547[[package]]
548name = "blocking"
549version = "1.5.1"
550source = "registry+https://github.com/rust-lang/crates.io-index"
551checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
552dependencies = [
553 "async-channel",
554 "async-lock 3.3.0",
555 "async-task",
556 "fastrand 2.0.1",
557 "futures-io",
558 "futures-lite 2.3.0",
559 "piper",
560 "tracing",
561]
562
394563[[package]]
395564name = "bs58"
396565version = "0.5.0"
@@ -911,6 +1080,17 @@ version = "0.3.8"
9111080source = "registry+https://github.com/rust-lang/crates.io-index"
9121081checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
9131082
1083[[package]]
1084name = "derivative"
1085version = "2.2.0"
1086source = "registry+https://github.com/rust-lang/crates.io-index"
1087checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
1088dependencies = [
1089 "proc-macro2",
1090 "quote",
1091 "syn 1.0.109",
1092]
1093
9141094[[package]]
9151095name = "derive_more"
9161096version = "0.99.17"
@@ -962,6 +1142,16 @@ dependencies = [
9621142 "dirs-sys",
9631143]
9641144
1145[[package]]
1146name = "dirs-next"
1147version = "2.0.0"
1148source = "registry+https://github.com/rust-lang/crates.io-index"
1149checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
1150dependencies = [
1151 "cfg-if",
1152 "dirs-sys-next",
1153]
1154
9651155[[package]]
9661156name = "dirs-sys"
9671157version = "0.3.7"
@@ -973,6 +1163,17 @@ dependencies = [
9731163 "winapi",
9741164]
9751165
1166[[package]]
1167name = "dirs-sys-next"
1168version = "0.1.2"
1169source = "registry+https://github.com/rust-lang/crates.io-index"
1170checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
1171dependencies = [
1172 "libc",
1173 "redox_users",
1174 "winapi",
1175]
1176
9761177[[package]]
9771178name = "displaydoc"
9781179version = "0.2.4"
@@ -1063,30 +1264,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
10631264checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
10641265
10651266[[package]]
1066name = "equivalent"
1067version = "1.0.1"
1267name = "enumflags2"
1268version = "0.7.9"
10681269source = "registry+https://github.com/rust-lang/crates.io-index"
1069checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
1270checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d"
1271dependencies = [
1272 "enumflags2_derive",
1273 "serde",
1274]
10701275
10711276[[package]]
1072name = "errno"
1073version = "0.3.4"
1277name = "enumflags2_derive"
1278version = "0.7.9"
10741279source = "registry+https://github.com/rust-lang/crates.io-index"
1075checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480"
1280checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
10761281dependencies = [
1077 "errno-dragonfly",
1078 "libc",
1079 "windows-sys 0.48.0",
1282 "proc-macro2",
1283 "quote",
1284 "syn 2.0.52",
10801285]
10811286
10821287[[package]]
1083name = "errno-dragonfly"
1084version = "0.1.2"
1288name = "equivalent"
1289version = "1.0.1"
1290source = "registry+https://github.com/rust-lang/crates.io-index"
1291checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
1292
1293[[package]]
1294name = "errno"
1295version = "0.3.8"
10851296source = "registry+https://github.com/rust-lang/crates.io-index"
1086checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
1297checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
10871298dependencies = [
1088 "cc",
10891299 "libc",
1300 "windows-sys 0.52.0",
10901301]
10911302
10921303[[package]]
@@ -1099,6 +1310,23 @@ dependencies = [
10991310 "str-buf",
11001311]
11011312
1313[[package]]
1314name = "event-listener"
1315version = "2.5.3"
1316source = "registry+https://github.com/rust-lang/crates.io-index"
1317checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
1318
1319[[package]]
1320name = "event-listener"
1321version = "3.1.0"
1322source = "registry+https://github.com/rust-lang/crates.io-index"
1323checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2"
1324dependencies = [
1325 "concurrent-queue",
1326 "parking",
1327 "pin-project-lite",
1328]
1329
11021330[[package]]
11031331name = "event-listener"
11041332version = "4.0.3"
@@ -1121,6 +1349,16 @@ dependencies = [
11211349 "pin-project-lite",
11221350]
11231351
1352[[package]]
1353name = "event-listener-strategy"
1354version = "0.4.0"
1355source = "registry+https://github.com/rust-lang/crates.io-index"
1356checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
1357dependencies = [
1358 "event-listener 4.0.3",
1359 "pin-project-lite",
1360]
1361
11241362[[package]]
11251363name = "event-listener-strategy"
11261364version = "0.5.0"
@@ -1205,6 +1443,15 @@ dependencies = [
12051443 "syn 2.0.52",
12061444]
12071445
1446[[package]]
1447name = "fastrand"
1448version = "1.9.0"
1449source = "registry+https://github.com/rust-lang/crates.io-index"
1450checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
1451dependencies = [
1452 "instant",
1453]
1454
12081455[[package]]
12091456name = "fastrand"
12101457version = "2.0.1"
@@ -1349,6 +1596,34 @@ version = "0.3.28"
13491596source = "registry+https://github.com/rust-lang/crates.io-index"
13501597checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
13511598
1599[[package]]
1600name = "futures-lite"
1601version = "1.13.0"
1602source = "registry+https://github.com/rust-lang/crates.io-index"
1603checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
1604dependencies = [
1605 "fastrand 1.9.0",
1606 "futures-core",
1607 "futures-io",
1608 "memchr",
1609 "parking",
1610 "pin-project-lite",
1611 "waker-fn",
1612]
1613
1614[[package]]
1615name = "futures-lite"
1616version = "2.3.0"
1617source = "registry+https://github.com/rust-lang/crates.io-index"
1618checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5"
1619dependencies = [
1620 "fastrand 2.0.1",
1621 "futures-core",
1622 "futures-io",
1623 "parking",
1624 "pin-project-lite",
1625]
1626
13521627[[package]]
13531628name = "futures-macro"
13541629version = "0.3.28"
@@ -1557,6 +1832,12 @@ version = "0.3.3"
15571832source = "registry+https://github.com/rust-lang/crates.io-index"
15581833checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
15591834
1835[[package]]
1836name = "hex"
1837version = "0.4.3"
1838source = "registry+https://github.com/rust-lang/crates.io-index"
1839checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1840
15601841[[package]]
15611842name = "hkdf"
15621843version = "0.12.4"
@@ -1709,6 +1990,7 @@ dependencies = [
17091990 "mime_guess",
17101991 "modalkit",
17111992 "modalkit-ratatui",
1993 "notify-rust",
17121994 "open",
17131995 "pretty_assertions",
17141996 "rand",
@@ -1742,7 +2024,7 @@ dependencies = [
17422024 "iana-time-zone-haiku",
17432025 "js-sys",
17442026 "wasm-bindgen",
1745 "windows",
2027 "windows 0.48.0",
17462028]
17472029
17482030[[package]]
@@ -1930,7 +2212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
19302212checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
19312213dependencies = [
19322214 "hermit-abi",
1933 "rustix 0.38.17",
2215 "rustix 0.38.32",
19342216 "windows-sys 0.48.0",
19352217]
19362218
@@ -2092,9 +2374,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
20922374
20932375[[package]]
20942376name = "linux-raw-sys"
2095version = "0.4.8"
2377version = "0.4.13"
20962378source = "registry+https://github.com/rust-lang/crates.io-index"
2097checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db"
2379checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
20982380
20992381[[package]]
21002382name = "lock_api"
@@ -2118,6 +2400,19 @@ version = "0.1.1"
21182400source = "registry+https://github.com/rust-lang/crates.io-index"
21192401checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
21202402
2403[[package]]
2404name = "mac-notification-sys"
2405version = "0.6.1"
2406source = "registry+https://github.com/rust-lang/crates.io-index"
2407checksum = "51fca4d74ff9dbaac16a01b924bc3693fa2bba0862c2c633abc73f9a8ea21f64"
2408dependencies = [
2409 "cc",
2410 "dirs-next",
2411 "objc-foundation",
2412 "objc_id",
2413 "time",
2414]
2415
21212416[[package]]
21222417name = "macroific"
21232418version = "1.3.1"
@@ -2611,6 +2906,19 @@ dependencies = [
26112906 "minimal-lexical",
26122907]
26132908
2909[[package]]
2910name = "notify-rust"
2911version = "4.10.0"
2912source = "registry+https://github.com/rust-lang/crates.io-index"
2913checksum = "827c5edfa80235ded4ab3fe8e9dc619b4f866ef16fe9b1c6b8a7f8692c0f2226"
2914dependencies = [
2915 "log",
2916 "mac-notification-sys",
2917 "serde",
2918 "tauri-winrt-notification",
2919 "zbus",
2920]
2921
26142922[[package]]
26152923name = "nu-ansi-term"
26162924version = "0.46.0"
@@ -2796,6 +3104,16 @@ dependencies = [
27963104 "vcpkg",
27973105]
27983106
3107[[package]]
3108name = "ordered-stream"
3109version = "0.2.0"
3110source = "registry+https://github.com/rust-lang/crates.io-index"
3111checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
3112dependencies = [
3113 "futures-core",
3114 "pin-project-lite",
3115]
3116
27993117[[package]]
28003118name = "overload"
28013119version = "0.1.1"
@@ -2952,6 +3270,17 @@ version = "0.1.0"
29523270source = "registry+https://github.com/rust-lang/crates.io-index"
29533271checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
29543272
3273[[package]]
3274name = "piper"
3275version = "0.2.1"
3276source = "registry+https://github.com/rust-lang/crates.io-index"
3277checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4"
3278dependencies = [
3279 "atomic-waker",
3280 "fastrand 2.0.1",
3281 "futures-io",
3282]
3283
29553284[[package]]
29563285name = "pkcs7"
29573286version = "0.4.1"
@@ -2994,7 +3323,7 @@ dependencies = [
29943323 "base64",
29953324 "indexmap 1.9.3",
29963325 "line-wrap",
2997 "quick-xml",
3326 "quick-xml 0.29.0",
29983327 "serde",
29993328 "time",
30003329]
@@ -3012,6 +3341,36 @@ dependencies = [
30123341 "miniz_oxide",
30133342]
30143343
3344[[package]]
3345name = "polling"
3346version = "2.8.0"
3347source = "registry+https://github.com/rust-lang/crates.io-index"
3348checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
3349dependencies = [
3350 "autocfg",
3351 "bitflags 1.3.2",
3352 "cfg-if",
3353 "concurrent-queue",
3354 "libc",
3355 "log",
3356 "pin-project-lite",
3357 "windows-sys 0.48.0",
3358]
3359
3360[[package]]
3361name = "polling"
3362version = "3.5.0"
3363source = "registry+https://github.com/rust-lang/crates.io-index"
3364checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9"
3365dependencies = [
3366 "cfg-if",
3367 "concurrent-queue",
3368 "pin-project-lite",
3369 "rustix 0.38.32",
3370 "tracing",
3371 "windows-sys 0.52.0",
3372]
3373
30153374[[package]]
30163375name = "poly1305"
30173376version = "0.8.0"
@@ -3151,6 +3510,15 @@ dependencies = [
31513510 "memchr",
31523511]
31533512
3513[[package]]
3514name = "quick-xml"
3515version = "0.30.0"
3516source = "registry+https://github.com/rust-lang/crates.io-index"
3517checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
3518dependencies = [
3519 "memchr",
3520]
3521
31543522[[package]]
31553523name = "quote"
31563524version = "1.0.35"
@@ -3238,7 +3606,7 @@ dependencies = [
32383606 "image",
32393607 "rand",
32403608 "ratatui",
3241 "rustix 0.38.17",
3609 "rustix 0.38.32",
32423610 "serde",
32433611]
32443612
@@ -3611,15 +3979,15 @@ dependencies = [
36113979
36123980[[package]]
36133981name = "rustix"
3614version = "0.38.17"
3982version = "0.38.32"
36153983source = "registry+https://github.com/rust-lang/crates.io-index"
3616checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7"
3984checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89"
36173985dependencies = [
36183986 "bitflags 2.4.2",
36193987 "errno",
36203988 "libc",
3621 "linux-raw-sys 0.4.8",
3622 "windows-sys 0.48.0",
3989 "linux-raw-sys 0.4.13",
3990 "windows-sys 0.52.0",
36233991]
36243992
36253993[[package]]
@@ -3798,6 +4166,17 @@ dependencies = [
37984166 "serde",
37994167]
38004168
4169[[package]]
4170name = "serde_repr"
4171version = "0.1.18"
4172source = "registry+https://github.com/rust-lang/crates.io-index"
4173checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
4174dependencies = [
4175 "proc-macro2",
4176 "quote",
4177 "syn 2.0.52",
4178]
4179
38014180[[package]]
38024181name = "serde_spanned"
38034182version = "0.6.5"
@@ -3819,6 +4198,17 @@ dependencies = [
38194198 "serde",
38204199]
38214200
4201[[package]]
4202name = "sha1"
4203version = "0.10.6"
4204source = "registry+https://github.com/rust-lang/crates.io-index"
4205checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
4206dependencies = [
4207 "cfg-if",
4208 "cpufeatures",
4209 "digest",
4210]
4211
38224212[[package]]
38234213name = "sha2"
38244214version = "0.10.8"
@@ -3987,6 +4377,12 @@ dependencies = [
39874377 "der",
39884378]
39894379
4380[[package]]
4381name = "static_assertions"
4382version = "1.1.0"
4383source = "registry+https://github.com/rust-lang/crates.io-index"
4384checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
4385
39904386[[package]]
39914387name = "str-buf"
39924388version = "1.0.6"
@@ -4124,6 +4520,16 @@ dependencies = [
41244520 "libc",
41254521]
41264522
4523[[package]]
4524name = "tauri-winrt-notification"
4525version = "0.1.3"
4526source = "registry+https://github.com/rust-lang/crates.io-index"
4527checksum = "006851c9ccefa3c38a7646b8cec804bb429def3da10497bfa977179869c3e8e2"
4528dependencies = [
4529 "quick-xml 0.30.0",
4530 "windows 0.51.1",
4531]
4532
41274533[[package]]
41284534name = "temp-dir"
41294535version = "0.1.12"
@@ -4137,9 +4543,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
41374543checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
41384544dependencies = [
41394545 "cfg-if",
4140 "fastrand",
4546 "fastrand 2.0.1",
41414547 "redox_syscall 0.3.5",
4142 "rustix 0.38.17",
4548 "rustix 0.38.32",
41434549 "windows-sys 0.48.0",
41444550]
41454551
@@ -4508,6 +4914,17 @@ version = "1.8.1"
45084914source = "registry+https://github.com/rust-lang/crates.io-index"
45094915checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6"
45104916
4917[[package]]
4918name = "uds_windows"
4919version = "1.1.0"
4920source = "registry+https://github.com/rust-lang/crates.io-index"
4921checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
4922dependencies = [
4923 "memoffset 0.9.0",
4924 "tempfile",
4925 "winapi",
4926]
4927
45114928[[package]]
45124929name = "ulid"
45134930version = "1.1.2"
@@ -4687,6 +5104,12 @@ dependencies = [
46875104 "zeroize",
46885105]
46895106
5107[[package]]
5108name = "waker-fn"
5109version = "1.1.1"
5110source = "registry+https://github.com/rust-lang/crates.io-index"
5111checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690"
5112
46905113[[package]]
46915114name = "walkdir"
46925115version = "2.4.0"
@@ -4832,7 +5255,7 @@ dependencies = [
48325255 "either",
48335256 "home",
48345257 "once_cell",
4835 "rustix 0.38.17",
5258 "rustix 0.38.32",
48365259]
48375260
48385261[[package]]
@@ -4890,6 +5313,25 @@ dependencies = [
48905313 "windows-targets 0.48.5",
48915314]
48925315
5316[[package]]
5317name = "windows"
5318version = "0.51.1"
5319source = "registry+https://github.com/rust-lang/crates.io-index"
5320checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
5321dependencies = [
5322 "windows-core",
5323 "windows-targets 0.48.5",
5324]
5325
5326[[package]]
5327name = "windows-core"
5328version = "0.51.1"
5329source = "registry+https://github.com/rust-lang/crates.io-index"
5330checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
5331dependencies = [
5332 "windows-targets 0.48.5",
5333]
5334
48935335[[package]]
48945336name = "windows-sys"
48955337version = "0.42.0"
@@ -5149,6 +5591,16 @@ version = "2.5.2"
51495591source = "registry+https://github.com/rust-lang/crates.io-index"
51505592checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546"
51515593
5594[[package]]
5595name = "xdg-home"
5596version = "1.1.0"
5597source = "registry+https://github.com/rust-lang/crates.io-index"
5598checksum = "21e5a325c3cb8398ad6cf859c1135b25dd29e186679cf2da7581d9679f63b38e"
5599dependencies = [
5600 "libc",
5601 "winapi",
5602]
5603
51525604[[package]]
51535605name = "xml5ever"
51545606version = "0.17.0"
@@ -5175,6 +5627,72 @@ version = "0.5.1"
51755627source = "registry+https://github.com/rust-lang/crates.io-index"
51765628checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
51775629
5630[[package]]
5631name = "zbus"
5632version = "3.15.2"
5633source = "registry+https://github.com/rust-lang/crates.io-index"
5634checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6"
5635dependencies = [
5636 "async-broadcast",
5637 "async-executor",
5638 "async-fs",
5639 "async-io 1.13.0",
5640 "async-lock 2.8.0",
5641 "async-process",
5642 "async-recursion",
5643 "async-task",
5644 "async-trait",
5645 "blocking",
5646 "byteorder",
5647 "derivative",
5648 "enumflags2",
5649 "event-listener 2.5.3",
5650 "futures-core",
5651 "futures-sink",
5652 "futures-util",
5653 "hex",
5654 "nix",
5655 "once_cell",
5656 "ordered-stream",
5657 "rand",
5658 "serde",
5659 "serde_repr",
5660 "sha1",
5661 "static_assertions",
5662 "tracing",
5663 "uds_windows",
5664 "winapi",
5665 "xdg-home",
5666 "zbus_macros",
5667 "zbus_names",
5668 "zvariant",
5669]
5670
5671[[package]]
5672name = "zbus_macros"
5673version = "3.15.2"
5674source = "registry+https://github.com/rust-lang/crates.io-index"
5675checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5"
5676dependencies = [
5677 "proc-macro-crate 1.3.1",
5678 "proc-macro2",
5679 "quote",
5680 "regex",
5681 "syn 1.0.109",
5682 "zvariant_utils",
5683]
5684
5685[[package]]
5686name = "zbus_names"
5687version = "2.6.1"
5688source = "registry+https://github.com/rust-lang/crates.io-index"
5689checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d"
5690dependencies = [
5691 "serde",
5692 "static_assertions",
5693 "zvariant",
5694]
5695
51785696[[package]]
51795697name = "zerocopy"
51805698version = "0.7.32"
@@ -5223,3 +5741,41 @@ checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
52235741dependencies = [
52245742 "simd-adler32",
52255743]
5744
5745[[package]]
5746name = "zvariant"
5747version = "3.15.2"
5748source = "registry+https://github.com/rust-lang/crates.io-index"
5749checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db"
5750dependencies = [
5751 "byteorder",
5752 "enumflags2",
5753 "libc",
5754 "serde",
5755 "static_assertions",
5756 "zvariant_derive",
5757]
5758
5759[[package]]
5760name = "zvariant_derive"
5761version = "3.15.2"
5762source = "registry+https://github.com/rust-lang/crates.io-index"
5763checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9"
5764dependencies = [
5765 "proc-macro-crate 1.3.1",
5766 "proc-macro2",
5767 "quote",
5768 "syn 1.0.109",
5769 "zvariant_utils",
5770]
5771
5772[[package]]
5773name = "zvariant_utils"
5774version = "1.0.1"
5775source = "registry+https://github.com/rust-lang/crates.io-index"
5776checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200"
5777dependencies = [
5778 "proc-macro2",
5779 "quote",
5780 "syn 1.0.109",
5781]
Cargo.toml +1
@@ -45,6 +45,7 @@ libc = "0.2"
4545markup5ever_rcdom = "0.2.0"
4646mime = "^0.3.16"
4747mime_guess = "^2.0.4"
48notify-rust = { version = "4.10.0", default-features = false, features = ["zbus", "serde"] }
4849open = "3.2.0"
4950rand = "0.8.5"
5051ratatui = "0.23"
docs/iamb.5.md +10
@@ -85,6 +85,16 @@ overridden as described in *PROFILES*.
8585**message_user_color** (type: boolean)
8686> Defines whether or not the message body is colored like the username.
8787
88**notifications** (type: notifications object)
89> Configures push-notifications, which are delivered as desktop
90> notifications if available.
91> *enabled* `true` to enable the feature, defaults to `false`.
92> *show_message* to show the message in the desktop notification. Defaults
93> to `true`. Messages are truncated beyond a small length.
94> The notification _rules_ are stored server side, loaded once at startup,
95> and are currently not configurable in iamb. In other words, you can
96> simply change the rules with another client.
97
8898**image_preview** (type: image_preview object)
8999> Enable image previews and configure it. An empty object will enable the
90100> feature with default settings, omitting it will disable the feature.
src/base.rs +7
@@ -761,6 +761,9 @@ pub struct RoomInfo {
761761
762762 /// The display names for users in this room.
763763 pub display_names: HashMap<OwnedUserId, String>,
764
765 /// The last time the room was rendered, used to detect if it is currently open.
766 pub draw_last: Option<Instant>,
764767}
765768
766769impl RoomInfo {
@@ -1192,6 +1195,9 @@ pub struct ChatStore {
11921195
11931196 /// Image preview "protocol" picker.
11941197 pub picker: Option<Picker>,
1198
1199 /// Last draw time, used to match with RoomInfo's draw_last.
1200 pub draw_curr: Option<Instant>,
11951201}
11961202
11971203impl ChatStore {
@@ -1212,6 +1218,7 @@ impl ChatStore {
12121218 verifications: Default::default(),
12131219 need_load: Default::default(),
12141220 sync_info: Default::default(),
1221 draw_curr: None,
12151222 }
12161223 }
12171224
src/config.rs +10
@@ -391,6 +391,12 @@ pub enum UserDisplayStyle {
391391 DisplayName,
392392}
393393
394#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)]
395pub struct Notifications {
396 pub enabled: bool,
397 pub show_message: Option<bool>,
398}
399
394400#[derive(Clone)]
395401pub struct ImagePreviewValues {
396402 pub size: ImagePreviewSize,
@@ -476,6 +482,7 @@ pub struct TunableValues {
476482 pub message_user_color: bool,
477483 pub default_room: Option<String>,
478484 pub open_command: Option<Vec<String>>,
485 pub notifications: Notifications,
479486 pub image_preview: Option<ImagePreviewValues>,
480487}
481488
@@ -496,6 +503,7 @@ pub struct Tunables {
496503 pub message_user_color: Option<bool>,
497504 pub default_room: Option<String>,
498505 pub open_command: Option<Vec<String>>,
506 pub notifications: Option<Notifications>,
499507 pub image_preview: Option<ImagePreview>,
500508}
501509
@@ -518,6 +526,7 @@ impl Tunables {
518526 message_user_color: self.message_user_color.or(other.message_user_color),
519527 default_room: self.default_room.or(other.default_room),
520528 open_command: self.open_command.or(other.open_command),
529 notifications: self.notifications.or(other.notifications),
521530 image_preview: self.image_preview.or(other.image_preview),
522531 }
523532 }
@@ -538,6 +547,7 @@ impl Tunables {
538547 message_user_color: self.message_user_color.unwrap_or(false),
539548 default_room: self.default_room,
540549 open_command: self.open_command,
550 notifications: self.notifications.unwrap_or_default(),
541551 image_preview: self.image_preview.map(ImagePreview::values),
542552 }
543553 }
src/main.rs +3 −1
@@ -24,7 +24,7 @@ use std::ops::DerefMut;
2424use std::process;
2525use std::sync::atomic::{AtomicUsize, Ordering};
2626use std::sync::Arc;
27use std::time::Duration;
27use std::time::{Duration, Instant};
2828
2929use clap::Parser;
3030use matrix_sdk::crypto::encrypt_room_key_export;
@@ -66,6 +66,7 @@ mod commands;
6666mod config;
6767mod keybindings;
6868mod message;
69mod notifications;
6970mod preview;
7071mod sled_export;
7172mod util;
@@ -305,6 +306,7 @@ impl Application {
305306 // Don't show terminal cursor when we show a dialog.
306307 let hide_cursor = !dialogstr.is_empty();
307308
309 store.application.draw_curr = Some(Instant::now());
308310 let screen = Screen::new(store)
309311 .show_dialog(dialogstr)
310312 .show_mode(modestr)
src/notifications.rs added +221
@@ -0,0 +1,221 @@
1use std::time::SystemTime;
2
3use matrix_sdk::{
4 notification_settings::{IsEncrypted, IsOneToOne, NotificationSettings, RoomNotificationMode},
5 room::Room as MatrixRoom,
6 ruma::{
7 api::client::push::get_notifications::v3::Notification,
8 events::{room::message::MessageType, AnyMessageLikeEventContent, AnySyncTimelineEvent},
9 MilliSecondsSinceUnixEpoch,
10 RoomId,
11 },
12 Client,
13};
14use unicode_segmentation::UnicodeSegmentation;
15
16use crate::{
17 base::{AsyncProgramStore, IambError, IambResult},
18 config::ApplicationSettings,
19};
20
21pub async fn register_notifications(
22 client: &Client,
23 settings: &ApplicationSettings,
24 store: &AsyncProgramStore,
25) {
26 if !settings.tunables.notifications.enabled {
27 return;
28 }
29 let show_message = settings.tunables.notifications.show_message;
30 let server_settings = client.notification_settings().await;
31 let Some(startup_ts) = MilliSecondsSinceUnixEpoch::from_system_time(SystemTime::now()) else {
32 return;
33 };
34
35 let store = store.clone();
36 client
37 .register_notification_handler(move |notification, room: MatrixRoom, client: Client| {
38 let store = store.clone();
39 let server_settings = server_settings.clone();
40 async move {
41 let mode = global_or_room_mode(&server_settings, &room).await;
42 if mode == RoomNotificationMode::Mute {
43 return;
44 }
45
46 if is_open(&store, room.room_id()).await {
47 return;
48 }
49
50 match parse_notification(notification, room).await {
51 Ok((summary, body, server_ts)) => {
52 if server_ts < startup_ts {
53 return;
54 }
55
56 let mut desktop_notification = notify_rust::Notification::new();
57 desktop_notification
58 .summary(&summary)
59 .appname("iamb")
60 .timeout(notify_rust::Timeout::Milliseconds(3000))
61 .action("default", "default");
62
63 if is_missing_mention(&body, mode, &client) {
64 return;
65 }
66 if show_message != Some(false) {
67 if let Some(body) = body {
68 desktop_notification.body(&body);
69 }
70 }
71 if let Err(err) = desktop_notification.show() {
72 tracing::error!("Failed to send notification: {err}")
73 }
74 },
75 Err(err) => {
76 tracing::error!("Failed to extract notification data: {err}")
77 },
78 }
79 }
80 })
81 .await;
82}
83
84async fn global_or_room_mode(
85 settings: &NotificationSettings,
86 room: &MatrixRoom,
87) -> RoomNotificationMode {
88 let room_mode = settings.get_user_defined_room_notification_mode(room.room_id()).await;
89 if let Some(mode) = room_mode {
90 return mode;
91 }
92 let is_one_to_one = match room.is_direct().await {
93 Ok(true) => IsOneToOne::Yes,
94 _ => IsOneToOne::No,
95 };
96 let is_encrypted = match room.is_encrypted().await {
97 Ok(true) => IsEncrypted::Yes,
98 _ => IsEncrypted::No,
99 };
100 settings
101 .get_default_room_notification_mode(is_encrypted, is_one_to_one)
102 .await
103}
104
105fn is_missing_mention(body: &Option<String>, mode: RoomNotificationMode, client: &Client) -> bool {
106 if let Some(body) = body {
107 if mode == RoomNotificationMode::MentionsAndKeywordsOnly {
108 let mentioned = match client.user_id() {
109 Some(user_id) => body.contains(user_id.localpart()),
110 _ => false,
111 };
112 return !mentioned;
113 }
114 }
115 false
116}
117
118async fn is_open(store: &AsyncProgramStore, room_id: &RoomId) -> bool {
119 let mut locked = store.lock().await;
120 if let Some(draw_curr) = locked.application.draw_curr {
121 let info = locked.application.get_room_info(room_id.to_owned());
122 if let Some(draw_last) = info.draw_last {
123 return draw_last == draw_curr;
124 }
125 }
126 false
127}
128
129pub async fn parse_notification(
130 notification: Notification,
131 room: MatrixRoom,
132) -> IambResult<(String, Option<String>, MilliSecondsSinceUnixEpoch)> {
133 let event = notification.event.deserialize().map_err(IambError::from)?;
134
135 let server_ts = event.origin_server_ts();
136
137 let sender_id = event.sender();
138 let sender = room.get_member_no_sync(sender_id).await.map_err(IambError::from)?;
139
140 let sender_name = sender
141 .as_ref()
142 .and_then(|m| m.display_name())
143 .unwrap_or_else(|| sender_id.localpart());
144
145 let body = event_notification_body(
146 &event,
147 sender_name,
148 room.is_direct().await.map_err(IambError::from)?,
149 )
150 .map(truncate);
151 return Ok((sender_name.to_string(), body, server_ts));
152}
153
154pub fn event_notification_body(
155 event: &AnySyncTimelineEvent,
156 sender_name: &str,
157 is_direct: bool,
158) -> Option<String> {
159 let AnySyncTimelineEvent::MessageLike(event) = event else {
160 return None;
161 };
162
163 match event.original_content()? {
164 AnyMessageLikeEventContent::RoomMessage(message) => {
165 let body = match message.msgtype {
166 MessageType::Audio(_) => {
167 format!("{sender_name} sent an audio file.")
168 },
169 MessageType::Emote(content) => {
170 let message = &content.body;
171 format!("{sender_name}: {message}")
172 },
173 MessageType::File(_) => {
174 format!("{sender_name} sent a file.")
175 },
176 MessageType::Image(_) => {
177 format!("{sender_name} sent an image.")
178 },
179 MessageType::Location(_) => {
180 format!("{sender_name} sent their location.")
181 },
182 MessageType::Notice(content) => {
183 let message = &content.body;
184 format!("{sender_name}: {message}")
185 },
186 MessageType::ServerNotice(content) => {
187 let message = &content.body;
188 format!("{sender_name}: {message}")
189 },
190 MessageType::Text(content) => {
191 if is_direct {
192 content.body
193 } else {
194 let message = &content.body;
195 format!("{sender_name}: {message}")
196 }
197 },
198 MessageType::Video(_) => {
199 format!("{sender_name} sent a video.")
200 },
201 MessageType::VerificationRequest(_) => {
202 format!("{sender_name} sent a verification request.")
203 },
204 _ => unimplemented!(),
205 };
206 Some(body)
207 },
208 AnyMessageLikeEventContent::Sticker(_) => Some(format!("{sender_name} sent a sticker.")),
209 _ => None,
210 }
211}
212
213fn truncate(s: String) -> String {
214 static MAX_LENGTH: usize = 100;
215 if s.graphemes(true).count() > MAX_LENGTH {
216 let truncated: String = s.graphemes(true).take(MAX_LENGTH).collect();
217 truncated + "..."
218 } else {
219 s
220 }
221}
src/tests.rs +3
@@ -27,6 +27,7 @@ use crate::{
2727 user_style_from_color,
2828 ApplicationSettings,
2929 DirectoryValues,
30 Notifications,
3031 ProfileConfig,
3132 SortOverrides,
3233 TunableValues,
@@ -164,6 +165,7 @@ pub fn mock_room() -> RoomInfo {
164165 fetch_last: None,
165166 users_typing: None,
166167 display_names: HashMap::new(),
168 draw_last: None,
167169 }
168170}
169171
@@ -198,6 +200,7 @@ pub fn mock_tunables() -> TunableValues {
198200 open_command: None,
199201 username_display: UserDisplayStyle::Username,
200202 message_user_color: false,
203 notifications: Notifications { enabled: false, show_message: None },
201204 image_preview: None,
202205 }
203206}
src/windows/room/scrollback.rs +2
@@ -1437,6 +1437,8 @@ impl<'a> StatefulWidget for Scrollback<'a> {
14371437 .need_load
14381438 .insert(state.room_id.to_owned(), Need::MESSAGES);
14391439 }
1440
1441 info.draw_last = self.store.application.draw_curr;
14401442 }
14411443}
14421444
src/worker.rs +4 −1
@@ -86,6 +86,7 @@ use modalkit::errors::UIError;
8686use modalkit::prelude::{EditInfo, InfoMessage};
8787
8888use crate::base::Need;
89use crate::notifications::register_notifications;
8990use crate::{
9091 base::{
9192 AsyncProgramStore,
@@ -1242,12 +1243,14 @@ impl ClientWorker {
12421243
12431244 self.load_handle = tokio::spawn({
12441245 let client = self.client.clone();
1246 let settings = self.settings.clone();
12451247
12461248 async move {
12471249 let load = load_older_forever(&client, &store);
12481250 let rcpt = send_receipts_forever(&client, &store);
12491251 let room = refresh_rooms_forever(&client, &store);
1250 let ((), (), ()) = tokio::join!(load, rcpt, room);
1252 let notifications = register_notifications(&client, &settings, &store);
1253 let ((), (), (), ()) = tokio::join!(load, rcpt, room, notifications);
12511254 }
12521255 })
12531256 .into();