diff --git a/package.json b/package.json index 51aa4f7..0d603b4 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "clsx": "^2.1.0", "next": "^14.1.0", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "tauri-plugin-clipboard-api": "^0.6.0" }, "devDependencies": { "@prettier/plugin-xml": "^3.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4ce4b39..bb00e77 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ dependencies: react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) + tauri-plugin-clipboard-api: + specifier: ^0.6.0 + version: 0.6.0 devDependencies: '@prettier/plugin-xml': @@ -4166,6 +4169,14 @@ packages: engines: {node: '>=6'} dev: true + /tauri-plugin-clipboard-api@0.6.0: + resolution: {integrity: sha512-8HNkCo+tPiY1sPKrlTkFexUlK/F2m0srUFnPyoL7VdD8BUQniT/0D9FBrm6VsczpLRy6YjD/EezbfN02Lq8PeQ==} + dependencies: + '@tauri-apps/api': 1.5.3 + tslib: 2.6.2 + zod: 3.22.4 + dev: false + /text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true @@ -4410,3 +4421,7 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} dev: true + + /zod@3.22.4: + resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} + dev: false diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 87e938d..75e9b1e 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -70,6 +70,8 @@ dependencies = [ "serde_json", "tauri", "tauri-build", + "tauri-plugin-clipboard", + "window-vibrancy", ] [[package]] @@ -78,8 +80,8 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aafb29b107435aa276664c1db8954ac27a6e105cdad3c88287a199eb0e313c08" dependencies = [ - "clipboard-win", - "core-graphics", + "clipboard-win 4.5.0", + "core-graphics 0.22.3", "image", "log", "objc", @@ -88,7 +90,7 @@ dependencies = [ "parking_lot", "thiserror", "winapi", - "x11rb", + "x11rb 0.12.0", ] [[package]] @@ -123,7 +125,7 @@ dependencies = [ "async-lock 3.0.0", "async-task", "concurrent-queue", - "fastrand 2.0.0", + "fastrand 2.0.1", "futures-lite 2.0.1", "slab", ] @@ -285,9 +287,15 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" [[package]] name = "bitflags" @@ -297,9 +305,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block" @@ -325,7 +333,7 @@ dependencies = [ "async-channel", "async-lock 3.0.0", "async-task", - "fastrand 2.0.0", + "fastrand 2.0.1", "futures-io", "futures-lite 2.0.1", "piper", @@ -488,17 +496,67 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "clipboard-files" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc2120eaf094b70a9c58bd1f8bb908cb74fbfe0c9793314567f7f8cea0be383" +dependencies = [ + "clipboard-win 4.5.0", + "gtk", + "objc", + "objc-foundation", + "objc_id", + "urlencoding", +] + +[[package]] +name = "clipboard-master" +version = "3.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459887701008d8ee21f8de7f45f0f0707417c7eea3311973f6e67222bd686b7a" +dependencies = [ + "objc", + "objc-foundation", + "objc_id", + "winapi", + "windows-win 2.4.1", + "x11-clipboard", +] + +[[package]] +name = "clipboard-rs" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbcc8f25c3698c94406c0165ab116b1ef47294f416d976a0b9a0e167a06471b9" +dependencies = [ + "clipboard-win 5.1.0", + "cocoa 0.25.0", + "image", + "windows-win 3.0.0", + "x11rb 0.13.0", +] + [[package]] name = "clipboard-win" version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" dependencies = [ - "error-code", + "error-code 2.3.1", "str-buf", "winapi", ] +[[package]] +name = "clipboard-win" +version = "5.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ec832972fefb8cf9313b45a0d1945e29c9c251f1d4c6eafc5fe2124c02d2e81" +dependencies = [ + "error-code 3.0.0", +] + [[package]] name = "cocoa" version = "0.24.1" @@ -509,8 +567,24 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation", - "core-graphics", - "foreign-types", + "core-graphics 0.22.3", + "foreign-types 0.3.2", + "libc", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "core-graphics 0.23.1", + "foreign-types 0.5.0", "libc", "objc", ] @@ -585,7 +659,20 @@ dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types 0.5.0", "libc", ] @@ -652,6 +739,12 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -826,6 +919,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + [[package]] name = "embed-resource" version = "2.4.1" @@ -902,6 +1001,12 @@ dependencies = [ "str-buf", ] +[[package]] +name = "error-code" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "281e452d3bad4005426416cdba5ccfd4f5c1280e10099e21db27f7c1c28347fc" + [[package]] name = "event-listener" version = "2.5.3" @@ -950,6 +1055,22 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "exr" +version = "1.72.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "887d93f60543e9a9362ef8a21beedd0a833c5d9610e18c67abe15a5963dcb1a4" +dependencies = [ + "bit_field", + "flume", + "half", + "lebe", + "miniz_oxide", + "rayon-core", + "smallvec", + "zune-inflate", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -961,9 +1082,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdeflate" @@ -992,7 +1113,7 @@ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "windows-sys 0.52.0", ] @@ -1006,6 +1127,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "spin", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1018,7 +1148,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] @@ -1027,6 +1178,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1099,7 +1256,7 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" dependencies = [ - "fastrand 2.0.0", + "fastrand 2.0.1", "futures-core", "futures-io", "memchr", @@ -1275,6 +1432,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -1297,6 +1464,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "gif" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" +dependencies = [ + "color_quant", + "weezl", +] + [[package]] name = "gimli" version = "0.28.1" @@ -1482,6 +1659,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1592,7 +1779,7 @@ dependencies = [ "httpdate", "itoa 1.0.9", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -1686,8 +1873,12 @@ dependencies = [ "bytemuck", "byteorder", "color_quant", + "exr", + "gif", + "jpeg-decoder", "num-traits", "png", + "qoi", "tiff", ] @@ -1808,6 +1999,9 @@ name = "jpeg-decoder" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" +dependencies = [ + "rayon", +] [[package]] name = "js-sys" @@ -1849,6 +2043,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + [[package]] name = "libc" version = "0.2.152" @@ -1861,9 +2061,9 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.2", "libc", - "redox_syscall 0.4.1", + "redox_syscall", ] [[package]] @@ -1883,9 +2083,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2229,9 +2429,9 @@ version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.2", "cfg-if", - "foreign-types", + "foreign-types 0.3.2", "libc", "once_cell", "openssl-macros", @@ -2353,7 +2553,7 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", "windows-targets 0.48.5", ] @@ -2523,7 +2723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.0", + "fastrand 2.0.1", "futures-io", ] @@ -2539,10 +2739,10 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a4a0cfc5fb21a09dc6af4bf834cf10d4a32fccd9e2ea468c4b1751a097487aa" dependencies = [ - "base64 0.21.2", + "base64 0.21.7", "indexmap 1.9.3", "line-wrap", - "quick-xml", + "quick-xml 0.30.0", "serde", "time", ] @@ -2643,6 +2843,24 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-xml" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" +dependencies = [ + "memchr", +] + [[package]] name = "quick-xml" version = "0.30.0" @@ -2749,12 +2967,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" [[package]] -name = "redox_syscall" -version = "0.3.5" +name = "rayon" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ - "bitflags 1.3.2", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", ] [[package]] @@ -2827,7 +3056,7 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.2", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2916,15 +3145,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.5", - "windows-sys 0.48.0", + "linux-raw-sys 0.4.13", + "windows-sys 0.52.0", ] [[package]] @@ -3096,7 +3325,7 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f58c3a1b3e418f61c25b2aeb43fc6c95eaa252b8cecdda67f401943e9e08d33f" dependencies = [ - "base64 0.21.2", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -3286,6 +3515,15 @@ dependencies = [ "system-deps 5.0.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3436,9 +3674,9 @@ dependencies = [ "bitflags 1.3.2", "cairo-rs", "cc", - "cocoa", + "cocoa 0.24.1", "core-foundation", - "core-graphics", + "core-graphics 0.22.3", "crossbeam-channel", "dispatch", "gdk", @@ -3510,7 +3748,7 @@ checksum = "fd27c04b9543776a972c86ccf70660b517ecabbeced9fb58d8b961a13ad129af" dependencies = [ "anyhow", "bytes", - "cocoa", + "cocoa 0.24.1", "dirs-next", "embed_plist", "encoding_rs", @@ -3582,7 +3820,7 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1554c5857f65dbc377cefb6b97c8ac77b1cb2a90d30d3448114d5d6b48a77fc" dependencies = [ - "base64 0.21.2", + "base64 0.21.7", "brotli", "ico", "json-patch", @@ -3616,6 +3854,23 @@ dependencies = [ "tauri-utils", ] +[[package]] +name = "tauri-plugin-clipboard" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b8de83f998fc461d976d64b47c9ecbaa849b8efaa224508f00cfb53a3503d7" +dependencies = [ + "base64 0.21.7", + "clipboard-files", + "clipboard-master", + "clipboard-rs", + "image", + "serde", + "tauri", + "tempfile", + "thiserror", +] + [[package]] name = "tauri-runtime" version = "0.14.2" @@ -3644,7 +3899,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6cae61fbc731f690a4899681c9052dde6d05b159b44563ace8186fc1bfb7d158" dependencies = [ "arboard", - "cocoa", + "cocoa 0.24.1", "gtk", "percent-encoding", "rand 0.8.5", @@ -3704,21 +3959,20 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006851c9ccefa3c38a7646b8cec804bb429def3da10497bfa977179869c3e8e2" dependencies = [ - "quick-xml", + "quick-xml 0.30.0", "windows 0.51.1", ] [[package]] name = "tempfile" -version = "3.8.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", - "fastrand 2.0.0", - "redox_syscall 0.3.5", - "rustix 0.38.4", - "windows-sys 0.48.0", + "fastrand 2.0.1", + "rustix 0.38.31", + "windows-sys 0.52.0", ] [[package]] @@ -4069,6 +4323,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" @@ -4391,6 +4651,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "window-vibrancy" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af6abc2b9c56bd95887825a1ce56cde49a2a97c07e28db465d541f5098a2656c" +dependencies = [ + "cocoa 0.25.0", + "objc", + "raw-window-handle", + "windows-sys 0.52.0", + "windows-version", +] + [[package]] name = "windows" version = "0.37.0" @@ -4574,6 +4847,24 @@ dependencies = [ "windows-targets 0.52.0", ] +[[package]] +name = "windows-win" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d4243ec23afe4e9b4e668b3c0a0e973f1b8265f6a46223cfcbc16fd267480c0" +dependencies = [ + "winapi", +] + +[[package]] +name = "windows-win" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e23e33622b3b52f948049acbec9bcc34bf6e26d74176b88941f213c75cf2dc" +dependencies = [ + "error-code 3.0.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -4797,8 +5088,8 @@ checksum = "6ad85d0e067359e409fcb88903c3eac817c392e5d638258abfb3da5ad8ba6fc4" dependencies = [ "base64 0.13.1", "block", - "cocoa", - "core-graphics", + "cocoa 0.24.1", + "core-graphics 0.22.3", "crossbeam-channel", "dunce", "gdk", @@ -4837,6 +5128,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "x11-clipboard" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "473068b7b80ac86a18328824f1054e5e007898c47b5bbc281bd7abe32bc3653c" +dependencies = [ + "xcb", +] + [[package]] name = "x11-dl" version = "2.21.0" @@ -4854,11 +5154,22 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" dependencies = [ - "gethostname", + "gethostname 0.3.0", "nix", "winapi", "winapi-wsapoll", - "x11rb-protocol", + "x11rb-protocol 0.12.0", +] + +[[package]] +name = "x11rb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" +dependencies = [ + "gethostname 0.4.3", + "rustix 0.38.31", + "x11rb-protocol 0.13.0", ] [[package]] @@ -4870,6 +5181,12 @@ dependencies = [ "nix", ] +[[package]] +name = "x11rb-protocol" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34" + [[package]] name = "xattr" version = "1.1.1" @@ -4879,6 +5196,17 @@ dependencies = [ "libc", ] +[[package]] +name = "xcb" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771e2b996df720cd1c6dd9ff90f62d91698fd3610cc078388d0564bdd6622a9c" +dependencies = [ + "libc", + "log", + "quick-xml 0.22.0", +] + [[package]] name = "xdg-home" version = "1.0.0" @@ -4955,6 +5283,15 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + [[package]] name = "zvariant" version = "3.15.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index fb6526a..a6fc016 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,12 +17,14 @@ tauri-build = { version = "1.5", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.5", features = ["api-all"] } +tauri = { version = "1.5", features = [ "macos-private-api", "api-all"] } +window-vibrancy = "0.4.0" +tauri-plugin-clipboard = "0.6.0" [features] # by default Tauri runs in production mode # when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL -default = [ "custom-protocol" ] +default = ["custom-protocol"] # this feature is used used for production builds where `devPath` points to the filesystem # DO NOT remove this -custom-protocol = [ "tauri/custom-protocol" ] +custom-protocol = ["tauri/custom-protocol"] diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 4eebecc..8fdb9e1 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,10 +1,12 @@ -#![cfg_attr( +use tauri::Manager; +use window_vibrancy::{apply_vibrancy, NSVisualEffectMaterial}; +use std::time::{SystemTime, UNIX_EPOCH}; + +#[cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows" )] -use std::time::{SystemTime, UNIX_EPOCH}; - #[tauri::command] fn on_button_clicked() -> String { let start = SystemTime::now(); @@ -16,8 +18,21 @@ fn on_button_clicked() -> String { } fn main() { + let context = tauri::generate_context!(); tauri::Builder::default() + .setup(|app| { + let window = app.get_window("main").unwrap(); + + // apply_acrylic(&window, Some((0, 0, 0, 10))); + + #[cfg(target_os = "macos")] + apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None) + .expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS"); + + Ok(()) + }) + .plugin(tauri_plugin_clipboard::init()) .invoke_handler(tauri::generate_handler![on_button_clicked]) - .run(tauri::generate_context!()) + .run(context) .expect("error while running tauri application"); } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 93b344f..67a2e5a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -11,8 +11,14 @@ "version": "0.1.0" }, "tauri": { + "macOSPrivateApi": true, "allowlist": { - "all": true + "all": true, + "clipboard": { + "all": true, + "writeText": true, + "readText": true + } }, "bundle": { "active": true, @@ -29,7 +35,7 @@ "icons/icon.icns", "icons/icon.ico" ], - "identifier": "com.tauri.dev", + "identifier": "com.katungi.pasta", "longDescription": "", "macOS": { "entitlements": null, @@ -57,9 +63,11 @@ { "fullscreen": false, "resizable": true, - "title": "Tauri NextJS App", - "width": 1280, - "height": 800 + "title": "Pasta", + "width": 800, + "height": 600, + "transparent": true, + "alwaysOnTop": false } ] } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index cc70106..dc86e87 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,107 +1,82 @@ -import { invoke } from "@tauri-apps/api/tauri" +import { UnlistenFn } from "@tauri-apps/api/event"; import type { NextPage } from "next" -import Head from "next/head" -import Image from "next/image" -import { useCallback, useState } from "react" - -import { Card } from "@/components/Card" -import { CardButton } from "@/components/CardButton" -import { useGlobalShortcut } from "@/hooks/tauri/shortcuts" - +import { useEffect, useState } from "react" +import { + listenToMonitorStatusUpdate, + onClipboardUpdate, + onFilesUpdate, + onImageUpdate, + onTextUpdate, + startListening, +} from "tauri-plugin-clipboard-api"; const Home: NextPage = () => { - const [buttonDesc, setButtonDesc] = useState( - "Waiting to be clicked. This calls 'on_button_clicked' from Rust.", - ) - const onButtonClick = () => { - invoke("on_button_clicked") - .then((value) => { - setButtonDesc(value) - }) - .catch(() => { - setButtonDesc("Failed to invoke Rust command 'on_button_clicked'") - }) - } + const [copiedText, setCopiedText] = useState("Copied text will be here"); - const shortcutHandler = useCallback(() => { - console.log("Ctrl+P was pressed!") - }, []) - useGlobalShortcut("CommandOrControl+P", shortcutHandler) + let unlistenTextUpdate: UnlistenFn; + let unlistenImageUpdate: UnlistenFn; + let unlistenClipboard: () => Promise; + let unlistenFiles: UnlistenFn; + let monitorRunning = false; - return ( -
- - Create Next App - - - + useEffect(() => { + const unlistenFunctions = async () => { + unlistenTextUpdate = await onTextUpdate((newText) => { + console.log(newText); + setCopiedText(newText); -
-

- Welcome to{" "} - - Next.js! - -

+ }); + unlistenImageUpdate = await onImageUpdate((_) => { + console.log("Image updated"); + }); + unlistenFiles = await onFilesUpdate((_) => { + console.log("Files updated"); + }); + unlistenClipboard = await startListening(); -

- Get started by editing{" "} - - src/pages/index.tsx - -

+ onClipboardUpdate(() => { + console.log( + "plugin:clipboard://clipboard-monitor/update event received" + ); + }); + }; -
- + listenToMonitorStatusUpdate((running) => { + monitorRunning = running; + }); + unlistenFunctions().catch(console.error); - + return () => { + if (unlistenTextUpdate) { + unlistenTextUpdate(); + } + if (unlistenImageUpdate) { + unlistenImageUpdate(); + } + if (unlistenClipboard) { + unlistenClipboard(); + } + if (unlistenFiles) { + unlistenFiles(); + } + console.log(monitorRunning); + }; - + }, []); - -
+ return ( +
+
+ {/* { + clips.map((clip, index) => { + return ( +
+

{copiedText || 'N/A'}

+
+ ) + } + )} */} +

{copiedText}

- -
) } diff --git a/src/styles/globals.css b/src/styles/globals.css index fe449cc..73fc45c 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -2,19 +2,16 @@ @tailwind components; @tailwind utilities; -html, -body { - padding: 0; - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, - Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; -} -a { - color: inherit; - text-decoration: none; +html, body { + /* background: rgba(41, 41, 41, 0.92); */ + height: 100%; + overflow: hidden; } * { + margin: 0; + padding: 0; box-sizing: border-box; -} + background: transparent; +} \ No newline at end of file