From 9c514830bc79aeb548d4fdcd5a05bfc8c873afc6 Mon Sep 17 00:00:00 2001 From: isark Date: Sun, 16 Jul 2023 20:57:43 +0200 Subject: [PATCH] Some progress on the overlay state machine --- .vscode/launch.json | 16 + src-tauri/Cargo.lock | 1119 +++++++++++++++++++++++++++++++++--- src-tauri/Cargo.toml | 4 +- src-tauri/src/main.rs | 232 ++++---- src-tauri/src/overlay.rs | 357 ++++++++++-- src-tauri/tauri.conf.json | 2 +- src/app/app.component.html | 7 +- src/app/app.component.ts | 27 +- src/app/app.module.ts | 3 +- 9 files changed, 1526 insertions(+), 241 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..10efcb2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug", + "program": "${workspaceFolder}/", + "args": [], + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 8788188..e53488f 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -7,11 +7,13 @@ name = "Nothing" version = "0.0.0" dependencies = [ "Underlayer", + "crossbeam", "log", "raw-window-handle", "serde", "serde_json", "simple_logger", + "statig", "tauri", "tauri-build", "x11rb", @@ -19,8 +21,8 @@ dependencies = [ [[package]] name = "Underlayer" -version = "0.1.3" -source = "git+https://git.isark.me/isark/Underlay.git#9bde4bfdae4ec3161d9fa3e8b8e849e6bfe166d5" +version = "0.2.2" +source = "git+https://git.isark.me/isark/Underlay.git#f4858eba43a94ee8f7c0e7287f8ed6e451f25703" dependencies = [ "crossbeam", "log", @@ -84,9 +86,131 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" + +[[package]] +name = "async-broadcast" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +dependencies = [ + "event-listener", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock", + "autocfg", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix 0.37.23", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-process" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +dependencies = [ + "async-io", + "async-lock", + "autocfg", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 0.37.23", + "signal-hook", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-recursion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.26", +] + +[[package]] +name = "async-task" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" + +[[package]] +name = "async-trait" +version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.26", +] [[package]] name = "atk" @@ -112,6 +236,12 @@ dependencies = [ "system-deps 6.1.1", ] +[[package]] +name = "atomic-waker" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" + [[package]] name = "autocfg" version = "1.1.0" @@ -172,6 +302,21 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "log", +] + [[package]] name = "brotli" version = "3.3.4" @@ -226,6 +371,9 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] [[package]] name = "cairo-rs" @@ -380,6 +528,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "concurrent-queue" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -545,7 +702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -579,7 +736,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -590,7 +747,18 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.25", + "syn 2.0.26", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -645,9 +813,9 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dtoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519b83cd10f5f6e969625a409f735182bea5558cd8b64c655806ceaae36f1999" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dtoa-short" @@ -674,7 +842,7 @@ dependencies = [ "rustc_version", "toml 0.7.6", "vswhom", - "winreg", + "winreg 0.11.0", ] [[package]] @@ -692,6 +860,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enumflags2" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.26", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -719,6 +908,12 @@ dependencies = [ "libc", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fastrand" version = "1.9.0" @@ -841,6 +1036,21 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -849,9 +1059,15 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + [[package]] name = "futures-task" version = "0.3.28" @@ -865,8 +1081,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -1188,6 +1407,25 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "h2" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1249,7 +1487,18 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", - "itoa 1.0.8", + "itoa 1.0.9", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", ] [[package]] @@ -1258,6 +1507,55 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.9", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.57" @@ -1387,6 +1685,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + [[package]] name = "is-terminal" version = "0.4.9" @@ -1406,9 +1710,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "javascriptcore-rs" @@ -1556,6 +1860,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" +[[package]] +name = "mac-notification-sys" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e72d50edb17756489e79d52eb146927bec8eba9dd48faadf9ef08bca3791ad5" +dependencies = [ + "cc", + "dirs-next", + "objc-foundation", + "objc_id", + "time", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -1618,6 +1935,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1628,6 +1951,35 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "ndk" version = "0.6.0" @@ -1681,6 +2033,19 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "notify-rust" +version = "4.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfa211d18e360f08e36c364308f394b5eb23a6629150690e109a916dc6f610e" +dependencies = [ + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1771,6 +2136,17 @@ dependencies = [ "objc_exception", ] +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -1815,35 +2191,116 @@ dependencies = [ ] [[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "pango" -version = "0.15.10" +name = "openssl" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags 1.3.2", - "glib", + "cfg-if", + "foreign-types", "libc", "once_cell", - "pango-sys", + "openssl-macros", + "openssl-sys", ] [[package]] -name = "pango-sys" -version = "0.15.10" +name = "openssl-macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "glib-sys", - "gobject-sys", - "libc", - "system-deps 6.1.1", -] + "proc-macro2", + "quote", + "syn 2.0.26", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_info" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" +dependencies = [ + "log", + "serde", + "winapi", +] + +[[package]] +name = "os_pipe" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pango" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" +dependencies = [ + "bitflags 1.3.2", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps 6.1.1", +] + +[[package]] +name = "parking" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" [[package]] name = "parking_lot" @@ -1865,7 +2322,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets", + "windows-targets 0.48.1", ] [[package]] @@ -2005,7 +2462,7 @@ dependencies = [ "base64 0.21.2", "indexmap 1.9.3", "line-wrap", - "quick-xml", + "quick-xml 0.29.0", "serde", "time", ] @@ -2023,6 +2480,22 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2077,13 +2550,22 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe" dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-xml" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" +dependencies = [ + "memchr", +] + [[package]] name = "quick-xml" version = "0.29.0" @@ -2095,9 +2577,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb" dependencies = [ "proc-macro2", ] @@ -2262,6 +2744,69 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +[[package]] +name = "reqwest" +version = "0.11.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +dependencies = [ + "base64 0.21.2", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg 0.10.1", +] + +[[package]] +name = "rfd" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea" +dependencies = [ + "block", + "dispatch", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "lazy_static", + "log", + "objc", + "objc-foundation", + "objc_id", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.37.0", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2306,15 +2851,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safemem" @@ -2331,6 +2876,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -2343,6 +2897,29 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "selectors" version = "0.22.0" @@ -2365,9 +2942,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] @@ -2389,16 +2966,16 @@ checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] name = "serde_json" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ - "itoa 1.0.8", + "itoa 1.0.9", "ryu", "serde", ] @@ -2411,7 +2988,7 @@ checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2423,6 +3000,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa 1.0.9", + "ryu", + "serde", +] + [[package]] name = "serde_with" version = "3.0.0" @@ -2448,7 +3037,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2483,6 +3072,17 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.7" @@ -2503,6 +3103,35 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared_child" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "signal-hook" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "simd-adler32" version = "0.3.5" @@ -2542,6 +3171,16 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "soup2" version = "0.2.1" @@ -2591,6 +3230,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "statig" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42c467cc59664639bf70b8225b1b4a9c30d926f3e010c29e804bf940d618c663" +dependencies = [ + "statig_macro", +] + +[[package]] +name = "statig_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4c61563b68df6e452ceece3fba1329c8c6a5d348fe17b0778fada28bc95fde" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "string_cache" version = "0.8.7" @@ -2636,15 +3296,28 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sys-locale" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", + "windows-sys 0.45.0", +] + [[package]] name = "system-deps" version = "5.0.0" @@ -2753,6 +3426,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fbe522898e35407a8e60dc3870f7579fea2fc262a6a6072eccdd37ae1e1d91e" dependencies = [ "anyhow", + "bytes", "cocoa", "dirs-next", "embed_plist", @@ -2765,19 +3439,26 @@ dependencies = [ "heck 0.4.1", "http", "ignore", + "notify-rust", "objc", "once_cell", "open", + "os_info", + "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", "regex", + "reqwest", + "rfd", "semver", "serde", "serde_json", "serde_repr", "serialize-to-javascript", + "shared_child", "state", + "sys-locale", "tar", "tauri-macros", "tauri-runtime", @@ -2930,6 +3611,16 @@ dependencies = [ "toml 0.7.6", ] +[[package]] +name = "tauri-winrt-notification" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5bff1d532fead7c43324a0fa33643b8621a47ce2944a633be4cb6c0240898f" +dependencies = [ + "quick-xml 0.23.1", + "windows 0.39.0", +] + [[package]] name = "tempfile" version = "3.6.0" @@ -2978,7 +3669,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -2997,7 +3688,7 @@ version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" dependencies = [ - "itoa 1.0.8", + "itoa 1.0.9", "libc", "num_threads", "serde", @@ -3044,8 +3735,36 @@ dependencies = [ "autocfg", "backtrace", "bytes", + "libc", + "mio", "num_cpus", "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] @@ -3080,9 +3799,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.12" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "serde", @@ -3091,6 +3810,12 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" @@ -3111,7 +3836,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", ] [[package]] @@ -3162,12 +3887,28 @@ dependencies = [ "serde_json", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "typenum" version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "uds_windows" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +dependencies = [ + "tempfile", + "winapi", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -3176,9 +3917,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -3228,6 +3969,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version-compare" version = "0.0.11" @@ -3266,6 +4013,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "walkdir" version = "2.3.3" @@ -3276,6 +4029,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3309,10 +4071,22 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -3331,7 +4105,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.26", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3342,6 +4116,29 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "wasm-streams" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webkit2gtk" version = "0.18.2" @@ -3467,6 +4264,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +dependencies = [ + "windows_aarch64_msvc 0.37.0", + "windows_i686_gnu 0.37.0", + "windows_i686_msvc 0.37.0", + "windows_x86_64_gnu 0.37.0", + "windows_x86_64_msvc 0.37.0", +] + [[package]] name = "windows" version = "0.39.0" @@ -3487,7 +4297,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets", + "windows-targets 0.48.1", ] [[package]] @@ -3531,13 +4341,37 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -3573,6 +4407,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" + [[package]] name = "windows_aarch64_msvc" version = "0.39.0" @@ -3591,6 +4431,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_i686_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" + [[package]] name = "windows_i686_gnu" version = "0.39.0" @@ -3609,6 +4455,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" + [[package]] name = "windows_i686_msvc" version = "0.39.0" @@ -3627,6 +4479,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_x86_64_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" + [[package]] name = "windows_x86_64_gnu" version = "0.39.0" @@ -3657,6 +4515,12 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" + [[package]] name = "windows_x86_64_msvc" version = "0.39.0" @@ -3677,13 +4541,22 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.9" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "winreg" version = "0.11.0" @@ -3783,3 +4656,117 @@ checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" dependencies = [ "libc", ] + +[[package]] +name = "xdg-home" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" +dependencies = [ + "nix", + "winapi", +] + +[[package]] +name = "zbus" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "byteorder", + "derivative", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix", + "once_cell", + "ordered-stream", + "rand 0.8.5", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "winapi", + "xdg-home", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + +[[package]] +name = "zvariant" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +dependencies = [ + "byteorder", + "enumflags2", + "libc", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0a8926a..bcdd8da 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" tauri-build = { version = "1.2", features = [] } [dependencies] -tauri = { version = "1.2", features = ["shell-open"] } +tauri = { version = "1.2", features = [ "api-all"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" Underlayer = { git = "https://git.isark.me/isark/Underlay.git" } @@ -23,6 +23,8 @@ simple_logger = "4.2.0" x11rb = "0.12.0" raw-window-handle = "0.5.2" +statig = "0.3.0" +crossbeam = "0.8.2" [features] diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 8da6620..d482d4c 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -3,9 +3,12 @@ use std::{sync::Mutex, time::Duration}; +use crossbeam::channel::Sender; +use overlay::{EnforceableEvent, Overlay}; use log::Level; -use overlay::{Overlay, Manager}; -use tauri::{LogicalSize, Manager, PhysicalPosition, PhysicalSize, Window}; +use simple_logger::SimpleLogger; +// use overlay::{Overlay, Manager}; +use tauri::{LogicalSize, Manager, PhysicalPosition, PhysicalSize, Window, StateManager}; use underlayer::Bounds; use x11rb::protocol::xproto::ConnectionExt; @@ -17,139 +20,132 @@ fn greet(name: &str) -> String { mod overlay; -fn show(window: &Window) { - window.set_always_on_top(true); - window.show(); - window.set_resizable(true); - - if let Ok(mut state) = window.state::().lock() { - if state.bounds.height == 0 || state.bounds.width == 0 { - return; - } - - window - .set_position(PhysicalPosition { - x: state.bounds.x, - y: state.bounds.y, - }) - .expect("msg"); - window - .set_size(PhysicalSize { - width: state.bounds.width, - height: state.bounds.height, - }) - .expect("msg"); +// fn show(window: &Window) { +// window.set_always_on_top(true); +// window.show(); +// window.set_resizable(true); + +// if let Ok(mut state) = window.state::().lock() { +// if state.bounds.height == 0 || state.bounds.width == 0 { +// return; +// } + +// window +// .set_position(PhysicalPosition { +// x: state.bounds.x, +// y: state.bounds.y, +// }) +// .expect("msg"); +// window +// .set_size(PhysicalSize { +// width: state.bounds.width, +// height: state.bounds.height, +// }) +// .expect("msg"); +// } +// std::thread::spawn(|| { +// std::thread::sleep(Duration::from_millis(50)); +// underlayer::focus_target(); +// }); +// } + +// fn hide(window: &Window) { +// window.hide(); +// window.set_resizable(false); +// } + +// type RuntimeWrapper = Mutex; + +// remember to call `.manage(MyState::default())` +#[tauri::command] +fn set_interactable(interactable: bool, state: tauri::State>) { + log::info!("set_interactable: {interactable:?}"); + if interactable { + state.send(EnforceableEvent::Force(overlay::StateEvent::Interactable)); + } else { + state.send(EnforceableEvent::Return); } - std::thread::spawn(|| { - std::thread::sleep(Duration::from_millis(50)); - underlayer::focus_target(); - }); } -fn hide(window: &Window) { - window.hide(); - window.set_resizable(false); +#[tauri::command] +fn set_auto_hide(auto_hide: bool, state: tauri::State>) { + log::info!("set_auto_hide: {auto_hide:?}"); + state.send(EnforceableEvent::AutoHide(auto_hide)); } -type RuntimeWrapper = Mutex; - fn main() { - simple_logger::init_with_level(Level::Info).expect("Could not initialize simple_logger"); + SimpleLogger::new().with_module_level("underlayer", log::LevelFilter::Info).with_level(log::LevelFilter::Trace).init().expect("Could not init logger"); tauri::Builder::default() - .manage(Mutex::new(Overlay { - should_take_focus: false, - bounds: Bounds { - x: 0, - y: 0, - width: 0, - height: 0, - }, - })) .setup(|app| { - let window = app.get_window("Overlay").unwrap(); - window.set_min_size::>(None); - let window2 = window.clone(); - window.on_window_event(move |e| match e { - tauri::WindowEvent::Focused(focus) => { - if *focus { - if let Ok(runtime) = window2.state::().lock() { - if !runtime.should_take_focus { - window2.set_ignore_cursor_events(true); - } - } - } - } - _ => {} - }); - - Manager::init( + let tx = Overlay::new( app.get_window("Overlay") .expect("Could not get main overlay window"), "Untitled 1 - Mousepad", ); - std::thread::spawn(move || { - log::info!("Running event thread"); - let mut target_is_focused = false; - - let underlay: std::sync::mpsc::Receiver = - underlayer::register("Untitled 1 - Mousepad"); - while let Ok(event) = underlay.recv() { - log::info!("Got event: {event:?}"); - match event { - underlayer::UnderlayEvent::Attach { - bounds, - has_access, - is_fullscreen, - } => { - if let Ok(mut state) = window.state::().lock() { - state.bounds = bounds; - } - } - underlayer::UnderlayEvent::Detach => { - hide(&window); - } - underlayer::UnderlayEvent::MoveResize(bounds) => { - if let Ok(mut state) = window.state::().lock() { - state.bounds = bounds; - - if bounds.height == 0 || bounds.width == 0 { - return; - } - - window - .set_position(PhysicalPosition { - x: bounds.x, - y: bounds.y, - }) - .expect("msg"); - window - .set_size(PhysicalSize { - width: bounds.width + 10, - height: bounds.height, - }) - .expect("msg"); - } - } - underlayer::UnderlayEvent::Focus => { - target_is_focused = true; - show(&window); - } - underlayer::UnderlayEvent::Blur => { - target_is_focused = false; - if !window.is_focused().unwrap() { - hide(&window); - } - } - underlayer::UnderlayEvent::X11FullscreenEvent { is_fullscreen } => {} - } - } - }); + app.manage(tx); + // std::thread::spawn(move || { + // log::info!("Running event thread"); + // let mut target_is_focused = false; + + // let underlay: std::sync::mpsc::Receiver = + // underlayer::register("Untitled 1 - Mousepad"); + // while let Ok(event) = underlay.recv() { + // log::info!("Got event: {event:?}"); + // match event { + // underlayer::UnderlayEvent::Attach { + // bounds, + // has_access, + // is_fullscreen, + // } => { + // if let Ok(mut state) = window.state::().lock() { + // state.bounds = bounds; + // } + // } + // underlayer::UnderlayEvent::Detach => { + // hide(&window); + // } + // underlayer::UnderlayEvent::MoveResize(bounds) => { + // if let Ok(mut state) = window.state::().lock() { + // state.bounds = bounds; + + // if bounds.height == 0 || bounds.width == 0 { + // return; + // } + + // window + // .set_position(PhysicalPosition { + // x: bounds.x, + // y: bounds.y, + // }) + // .expect("msg"); + // window + // .set_size(PhysicalSize { + // width: bounds.width + 10, + // height: bounds.height, + // }) + // .expect("msg"); + // } + // } + // underlayer::UnderlayEvent::Focus => { + // target_is_focused = true; + // show(&window); + // } + // underlayer::UnderlayEvent::Blur => { + // target_is_focused = false; + // if !window.is_focused().unwrap() { + // hide(&window); + // } + // } + // underlayer::UnderlayEvent::X11FullscreenEvent { is_fullscreen } => {} + // } + // } + // }); Ok(()) }) - .invoke_handler(tauri::generate_handler![greet]) + .invoke_handler(tauri::generate_handler![set_interactable, set_auto_hide]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src-tauri/src/overlay.rs b/src-tauri/src/overlay.rs index 33c8fea..d92d633 100644 --- a/src-tauri/src/overlay.rs +++ b/src-tauri/src/overlay.rs @@ -1,65 +1,342 @@ -use std::{sync::{Arc, Mutex}, marker::PhantomData}; +#![allow(unused)] -use tauri::{Manager as TManager, Window}; +use std::{ + borrow::BorrowMut, + cell::RefCell, + ops::DerefMut, + sync::{mpsc::Receiver as MpscReceiver, Arc, Mutex}, + time::Duration, +}; + +use crossbeam::{ + channel::{Receiver, Sender}, + select, +}; +// The prelude module re-exports the most common used items from statig. +use statig::prelude::*; +use tauri::{PhysicalPosition, PhysicalSize, Window}; use underlayer::{Bounds, UnderlayEvent}; +use crate::overlay; + +pub enum StateEvent { + Visible, + Hidden, + Interactable, +} + +pub enum EnforceableEvent { + Force(StateEvent), + Request(StateEvent), + Relax, + Bounds(Bounds), + AutoHide(bool), + Return +} + +#[derive(Clone)] pub struct Overlay { - should_take_focus: bool, bounds: Bounds, + window: Window, + auto_hide: bool, + previous: State, } -pub struct Manager { - window: Window, - should_take_focus: bool, - bounds: Bounds, - state: PhantomData +fn wrap_underlay_rx(rx: MpscReceiver) -> Receiver { + let (cb_underlay_tx, cb_underlay_rx) = crossbeam::channel::unbounded(); + std::thread::spawn(move || { + while let Ok(event) = rx.recv() { + cb_underlay_tx.send(event).ok(); + } + }); + cb_underlay_rx } -pub type ManagerData = Arc>; - -impl Manager { - pub fn init(window: Window, target_label: &str) { - std::thread::spawn(move || { - let manager = Arc::new(Mutex::new(Manager { - window, - should_take_focus: false, - bounds: Default::default(), - state: PhantomData, - })); - - let app = window.app_handle(); - let underlay_rx = underlayer::register(target_label); - app.manage(manager.clone()); - - while let Ok(event) = underlay_rx.recv() { - app.state::().lock().and_then(|mut manager| { - manager.on_event(event); - Ok(()) - }); +impl Overlay { + pub fn new(window: Window, target_title: &str) -> Sender { + log::warn!("New overlay object"); + let mut overlay = Self { + window: window.clone(), + bounds: Bounds::default(), + auto_hide: true, + previous: State::hidden(), + }; + + let mut fsm = Overlay::uninitialized_state_machine(overlay).init(); + + let underlay_rx = wrap_underlay_rx(underlayer::register(target_title)); + let (ee_tx, ee_rx) = crossbeam::channel::unbounded(); + let (window_event_tx, window_event_rx) = crossbeam::channel::unbounded(); + + window.on_window_event(move |event| match event { + tauri::WindowEvent::Focused(focus) => { + window_event_tx.send(*focus).ok(); + } + _ => {} + }); + + std::thread::spawn(move || loop { + select! { + recv(underlay_rx) -> msg => { + match msg { + Ok(event) => { + Self::handle_underlay_event(&mut fsm, event); + }, + Err(_) => break, + } + }, + recv(ee_rx) -> msg => { + match msg { + Ok(event) => { + Self::handle_enforceable_event(&mut fsm, event); + }, + Err(_) => break, + } + }, + recv(window_event_rx) -> msg => { + match msg { + Ok(focus) => Self::handle_overlay_focused(&mut fsm, focus), + Err(_) => break, + } + } } }); + + ee_tx } - fn on_event(&mut self, event: UnderlayEvent) { - + fn handle_overlay_focused(fsm: &mut InitializedStateMachine, focus: bool) { + match fsm.state() { + State::Visible {} | State::EnforcedVisible {} => { + if focus { + fsm.window.set_ignore_cursor_events(true); + underlayer::focus_target(); + } + } + _ => {} + } + } + + fn handle_underlay_event(fsm: &mut InitializedStateMachine, event: UnderlayEvent) { + log::info!("EVENT: {event:?}"); + match event { + UnderlayEvent::Attach { + bounds, + has_access, + is_fullscreen, + } => { + fsm.handle(&EnforceableEvent::Bounds(bounds)); + } + UnderlayEvent::MoveResize(bounds) => fsm.handle(&EnforceableEvent::Bounds(bounds)), + UnderlayEvent::Detach => fsm.handle(&EnforceableEvent::Request(StateEvent::Hidden)), + UnderlayEvent::Focus => fsm.handle(&EnforceableEvent::Request(StateEvent::Visible)), + UnderlayEvent::Blur => { + if !fsm.window.is_focused().unwrap() && fsm.auto_hide { + fsm.handle(&EnforceableEvent::Request(StateEvent::Hidden)) + } + } + UnderlayEvent::X11FullscreenEvent { is_fullscreen } => {} + } + } + + fn handle_enforceable_event( + fsm: &mut InitializedStateMachine, + event: EnforceableEvent, + ) { + fsm.handle(&event); } } +// let mut fsm = fsm::Overlay::uninitialized_state_machine(Default::default()).init(); +// fsm.handle(&EnforceableEvent::Force(fsm::StateEvent::Visible)); +// fsm.handle(&EnforceableEvent::Relax); +// fsm.handle(&EnforceableEvent::Request(fsm::StateEvent::Interactable)); +// fsm.handle(&EnforceableEvent::Request(fsm::StateEvent::Hidden)); +/// The `state_machine` procedural macro generates the `State` and `Superstate` +/// enums by parsing the function signatures with a `state`, `superstate` or +/// `action` attribute. It also implements the `statig::State` and +/// `statig::Superstate` traits. We also pass an argument that will add the +/// derive macro with the Debug trait to the `State` enum. +#[state_machine( + initial = "State::hidden()", + state(derive(Debug, Clone, PartialEq, Eq)), + superstate(derive(Debug)), + on_transition = "Self::on_transition" +)] +impl Overlay { + #[action] + fn on_enter_visible(&mut self) { + self.window.set_always_on_top(true); + self.window.show(); + self.window.set_resizable(true); + if self.bounds.width > 0 && self.bounds.height > 0 { + self.window + .set_position(PhysicalPosition::new(self.bounds.x, self.bounds.y)); + self.window + .set_size(PhysicalSize::new(self.bounds.width, self.bounds.height)); + } -struct Visible; -struct Interactable; -struct Hidden; + log::info!("on_enter_visible"); + } -/* + #[action] + fn on_enter_interactable(&mut self) { + log::info!("on_enter_interactable"); + self.window.set_ignore_cursor_events(false); + } -should_take_focus + #[action] + fn on_enter_hidden(&mut self) { + log::info!("on_enter_hidden"); + self.window.hide(); + self.window.set_resizable(false); + } + #[action] + fn on_exit_interactable(&mut self) { + log::info!("on_exit_interactable"); + self.window.set_ignore_cursor_events(true); + } -Overlay visible + #[state(superstate = "super_visible")] + fn enforced_visible(&mut self, event: &EnforceableEvent) -> Response { + match event { + EnforceableEvent::Force(StateEvent::Visible) => Super, + EnforceableEvent::Force(event) => Self::match_forced(event), + EnforceableEvent::Request(_) => Handled, + EnforceableEvent::Relax => Transition(State::visible()), + _ => Super, + } + } -Overlay interactable + #[state(superstate = "super_visible")] + fn visible(&mut self, event: &EnforceableEvent) -> Response { + match event { + EnforceableEvent::Force(underlying) => Self::match_forced(underlying), + EnforceableEvent::Request(underlying) => match underlying { + StateEvent::Visible => Super, + StateEvent::Hidden => Transition(State::hidden()), + StateEvent::Interactable => Transition(State::interactable()), + }, + EnforceableEvent::Relax => Super, + _ => Super, + } + } -Overlay hidden + #[state(superstate = "super_hidden")] + fn enforced_hidden(&mut self, event: &EnforceableEvent) -> Response { + match event { + EnforceableEvent::Force(StateEvent::Hidden) => Super, + EnforceableEvent::Force(event) => Self::match_forced(event), + EnforceableEvent::Request(_) => Handled, + EnforceableEvent::Relax => Transition(State::hidden()), + _ => Super, + } + } -*/ + #[state(superstate = "super_hidden")] + fn hidden(&mut self, event: &EnforceableEvent) -> Response { + match event { + EnforceableEvent::Force(underlying) => Self::match_forced(underlying), + EnforceableEvent::Request(underlying) => match underlying { + StateEvent::Visible => Transition(State::visible()), + StateEvent::Hidden => Super, + StateEvent::Interactable => Transition(State::interactable()), + }, + EnforceableEvent::Relax => Super, + _ => Super, + } + } + + #[state(superstate = "super_interactable")] + fn enforced_interactable(&mut self, event: &EnforceableEvent) -> Response { + match event { + EnforceableEvent::Force(StateEvent::Interactable) => Super, + EnforceableEvent::Force(event) => Self::match_forced(event), + EnforceableEvent::Request(_) => Handled, + EnforceableEvent::Relax => Transition(State::interactable()), + _ => Super, + } + } + + #[state(superstate = "super_interactable")] + fn interactable(&mut self, event: &EnforceableEvent) -> Response { + match event { + EnforceableEvent::Force(underlying) => Self::match_forced(underlying), + EnforceableEvent::Request(underlying) => match underlying { + StateEvent::Visible => Transition(State::visible()), + StateEvent::Hidden => Transition(State::hidden()), + StateEvent::Interactable => Super, + }, + EnforceableEvent::Relax => Super, + _ => Super, + } + } + + fn match_forced(event: &StateEvent) -> Response { + match event { + StateEvent::Hidden => Transition(State::enforced_hidden()), + StateEvent::Interactable => Transition(State::enforced_interactable()), + StateEvent::Visible => Transition(State::enforced_visible()), + } + } + + #[superstate(superstate = "common", entry_action = "on_enter_visible")] + fn super_visible(&mut self, event: &EnforceableEvent) -> Response { + log::info!("in super_visible"); + Super + } + + #[superstate( + superstate = "super_visible", + entry_action = "on_enter_interactable", + exit_action = "on_exit_interactable" + )] + fn super_interactable(&mut self, event: &EnforceableEvent) -> Response { + log::info!("in super_interactable"); + Super + } + + #[superstate( + superstate = "common", + entry_action = "on_visible", + entry_action = "on_enter_hidden" + )] + fn super_hidden(&mut self, event: &EnforceableEvent) -> Response { + log::info!("in super_hidden"); + Super + } + + #[superstate] + fn common(&mut self, event: &EnforceableEvent) -> Response { + log::info!("in common"); + match event { + EnforceableEvent::Bounds(bounds) => { + self.bounds = *bounds; + if bounds.width > 0 && bounds.height > 0 { + self.window + .set_position(PhysicalPosition::new(bounds.x, bounds.y)); + self.window + .set_size(PhysicalSize::new(bounds.width, bounds.height)); + } + Super + } + EnforceableEvent::Relax => Super, + EnforceableEvent::AutoHide(auto_hide) => { + self.auto_hide = *auto_hide; + Super + } + EnforceableEvent::Return => { + log::info!("Returning to: {:?}", self.previous); + Transition(self.previous.clone()) + } + _ => Super, + } + } + + fn on_transition(&mut self, src: &State, dest: &State) { + log::info!("from {src:?} to {dest:?}"); + self.previous = src.clone(); + } +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 09349ac..deec0d4 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -12,7 +12,7 @@ }, "tauri": { "allowlist": { - "all": false, + "all": true, "shell": { "all": false, "open": true diff --git a/src/app/app.component.html b/src/app/app.component.html index b334bea..884f049 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -10,10 +10,7 @@

Click on the logos to learn more about the frameworks

-
- - -
-

{{ greetingMessage }}

+ + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 631055e..abbf1a6 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,20 +1,29 @@ -import { Component } from "@angular/core"; +import { AfterViewInit, Component, OnInit } from "@angular/core"; +import { app } from "@tauri-apps/api"; import { invoke } from "@tauri-apps/api/tauri"; +import { register } from "@tauri-apps/api/globalShortcut"; @Component({ selector: "app-root", templateUrl: "./app.component.html", styleUrls: ["./app.component.css"], }) -export class AppComponent { - greetingMessage = ""; +export class AppComponent implements OnInit { + auto_hide: boolean = true; + interactable: boolean = false; + + ngOnInit(): void { + register('F6', () => { + this.interactable = !this.interactable; + invoke("set_interactable", {interactable: this.interactable}).then(); + }).then(); - greet(event: SubmitEvent, name: string): void { - event.preventDefault(); + invoke("set_auto_hide", {auto_hide: this.auto_hide}).then(); + } - // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command - invoke("greet", { name }).then((text) => { - this.greetingMessage = text; - }); + toggleAutoHide() { + console.log("toggle auto hide!!"); + invoke("set_auto_hide", {autoHide: this.auto_hide}).then(); } + } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 0cd34fa..2605abf 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,10 +2,11 @@ import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; import { AppComponent } from "./app.component"; +import { FormsModule } from "@angular/forms"; @NgModule({ declarations: [AppComponent], - imports: [BrowserModule], + imports: [BrowserModule, FormsModule], providers: [], bootstrap: [AppComponent], })