diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index fa36a96..f8eafc2 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -34,16 +34,18 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "app" version = "0.1.0" dependencies = [ + "cocoa 0.24.1 (git+https://github.com/servo/core-foundation-rs/)", "home", "image", + "objc", "serde", "serde_json", "tauri", @@ -205,9 +207,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.13.0" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa0e3586af56b3bfa51fca452bd56e8dbbbd5d8d81cbf0b7e4e35b695b537eb8" +checksum = "497049e9477329f8f6a559972ee42e117487d01d1e8c2cc9f836ea6fa23a9e1a" dependencies = [ "serde", "toml", @@ -215,9 +217,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cesu8" @@ -267,9 +269,24 @@ checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" dependencies = [ "bitflags", "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", + "cocoa-foundation 0.1.0", + "core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.24.1" +source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993" +dependencies = [ + "bitflags", + "block", + "cocoa-foundation 0.1.1", + "core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)", + "core-graphics 0.22.3 (git+https://github.com/servo/core-foundation-rs/)", "foreign-types", "libc", "objc", @@ -283,8 +300,22 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ "bitflags", "block", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics-types 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.1" +source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993" +dependencies = [ + "bitflags", + "block", + "core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)", + "core-graphics-types 0.1.1 (git+https://github.com/servo/core-foundation-rs/)", "foreign-types", "libc", "objc", @@ -318,7 +349,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993" +dependencies = [ + "core-foundation-sys 0.8.3 (git+https://github.com/servo/core-foundation-rs/)", "libc", ] @@ -328,6 +368,11 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993" + [[package]] name = "core-graphics" version = "0.22.3" @@ -335,8 +380,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ "bitflags", - "core-foundation", - "core-graphics-types", + "core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics-types 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993" +dependencies = [ + "bitflags", + "core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)", + "core-graphics-types 0.1.1 (git+https://github.com/servo/core-foundation-rs/)", "foreign-types", "libc", ] @@ -348,7 +405,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ "bitflags", - "core-foundation", + "core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.1" +source = "git+https://github.com/servo/core-foundation-rs/#8c2444066aac42c20443b696270f5b1afff18993" +dependencies = [ + "bitflags", + "core-foundation 0.9.3 (git+https://github.com/servo/core-foundation-rs/)", "foreign-types", "libc", ] @@ -1108,9 +1176,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] @@ -1146,7 +1214,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.4", + "itoa 1.0.5", ] [[package]] @@ -1254,9 +1322,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "javascriptcore-rs" @@ -1380,9 +1448,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libloading" @@ -1605,9 +1673,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ "hermit-abi", "libc", @@ -1724,9 +1792,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "percent-encoding" @@ -1736,9 +1804,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" +checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4" dependencies = [ "thiserror", "ucd-trie", @@ -1955,24 +2023,24 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.19" +version = "0.5.20+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2159,20 +2227,20 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver 1.0.16", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "safemem" @@ -2238,9 +2306,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde", ] @@ -2256,18 +2324,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.150" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.150" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2276,20 +2344,20 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ - "itoa 1.0.4", + "itoa 1.0.5", "ryu", "serde", ] [[package]] name = "serde_repr" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" dependencies = [ "proc-macro2", "quote", @@ -2477,9 +2545,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -2514,16 +2582,16 @@ dependencies = [ [[package]] name = "tao" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa15735311b4816d030ff54da58560b047daca0970e1031aed5502e84231a8" +checksum = "ac8e6399427c8494f9849b58694754d7cc741293348a6836b6c8d2c5aa82d8e6" dependencies = [ "bitflags", "cairo-rs", "cc", - "cocoa", - "core-foundation", - "core-graphics", + "cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel", "dirs-next", "dispatch", @@ -2573,12 +2641,12 @@ dependencies = [ [[package]] name = "tauri" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8ea1d785ab2164373703817bff144c4610a69ad3f659becaca0e1ea004b98d8" +checksum = "5b48820ee3bb6a5031a83b2b6e11f8630bdc5a2f68cb841ab8ebc7a15a916679" dependencies = [ "anyhow", - "cocoa", + "cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)", "dirs-next", "embed_plist", "encoding_rs", @@ -2595,7 +2663,7 @@ dependencies = [ "percent-encoding", "rand 0.8.5", "raw-window-handle", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde_json", "serde_repr", @@ -2626,7 +2694,7 @@ dependencies = [ "cargo_toml", "heck 0.4.0", "json-patch", - "semver 1.0.14", + "semver 1.0.16", "serde_json", "tauri-utils", "winres", @@ -2646,7 +2714,7 @@ dependencies = [ "png", "proc-macro2", "quote", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde_json", "sha2", @@ -2708,7 +2776,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36b1c5764a41a13176a4599b5b7bd0881bea7d94dfe45e1e755f789b98317e30" dependencies = [ - "cocoa", + "cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)", "gtk", "percent-encoding", "rand 0.8.5", @@ -2740,7 +2808,7 @@ dependencies = [ "phf 0.10.1", "proc-macro2", "quote", - "semver 1.0.14", + "semver 1.0.16", "serde", "serde_json", "serde_with", @@ -2783,18 +2851,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -2836,7 +2904,7 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ - "itoa 1.0.4", + "itoa 1.0.5", "serde", "time-core", "time-macros", @@ -2888,9 +2956,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] @@ -2986,9 +3054,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" @@ -3411,8 +3479,8 @@ checksum = "4c1ad8e2424f554cc5bdebe8aa374ef5b433feff817aebabca0389961fc7ef98" dependencies = [ "base64", "block", - "cocoa", - "core-graphics", + "cocoa 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel", "dunce", "gdk", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0489c7d..e68a4d8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,16 +17,20 @@ tauri-build = { version = "1.2.1", features = [] } [dependencies] serde_json = "1.0.89" serde = { version = "1.0.150", features = ["derive"] } -tauri = { version = "1.2.2", features = ["system-tray"] } +tauri = { version = "1.2.3", features = ["system-tray"] } image = "0.24.5" home = "0.5" tauri-utils = "1.2.1" tauri-plugin-window-state = { git = "https://github.com/tauri-apps/tauri-plugin-window-state", branch = "dev"} +# webbrowser = "0.8.2" +# wry = "0.23.4" [target.'cfg(target_os = "linux")'.dependencies] webkit2gtk = "0.18.0" -# webbrowser = "0.8.2" -# wry = "0.23.4" + +[target.'cfg(target_os = "macos")'.dependencies] +objc = "0.2.7" +cocoa = {git = "https://github.com/servo/core-foundation-rs/"} [features] # by default Tauri runs in production mode diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 6bd2441..fed8902 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,6 +1,10 @@ #[cfg(target_os = "macos")] use tauri::MenuItem; +#[cfg(target_os = "macos")] +#[macro_use] +extern crate objc; + use tauri::{ window::PlatformWebview, App, Config, CustomMenuItem, Manager, Menu, Submenu, SystemTray, SystemTrayEvent, SystemTrayMenu, Window, WindowBuilder, WindowMenuEvent, WindowUrl, @@ -9,6 +13,7 @@ use tauri::{ pub fn get_menu() -> Menu { // first menu let hide = CustomMenuItem::new("hide", "Hide"); + let show = CustomMenuItem::new("show", "Show"); let close = CustomMenuItem::new("close", "Close"); let quit = CustomMenuItem::new("quit", "Quit"); #[cfg(target_os = "macos")] @@ -24,6 +29,7 @@ pub fn get_menu() -> Menu { .add_native_item(MenuItem::SelectAll) .add_native_item(MenuItem::Separator) .add_item(hide) + .add_item(show) .add_item(close) .add_item(quit); #[cfg(any(target_os = "linux", target_os = "windows"))] @@ -102,6 +108,7 @@ pub fn zoom_reset(webview: PlatformWebview) { pub fn menu_event_handle(event: WindowMenuEvent) { match event.menu_item_id() { "hide" => event.window().hide().expect("can't hide window"), + "show" => event.window().show().expect("can't show window"), "close" => event.window().close().expect("can't close window"), "quit" => std::process::exit(0), "zoom_out" => { @@ -209,24 +216,30 @@ pub fn system_tray_handle(app: &tauri::AppHandle, event: tauri::SystemTrayEvent) }; } -pub fn get_data_dir(tauri_config: Config) -> std::path::PathBuf { - let package_name = tauri_config.package.product_name.unwrap(); - let home_dir = match home::home_dir() { - Some(path1) => path1, - None => panic!("Error, can't found you home dir!!"), +pub fn get_data_dir(_tauri_config: Config) -> std::path::PathBuf { + #[cfg(any(target_os = "linux", target_os = "windows"))] + let data_dir = { + let package_name = _tauri_config.package.product_name.unwrap(); + let home_dir = match home::home_dir() { + Some(path1) => path1, + None => panic!("Error, can't found you home dir!!"), + }; + #[cfg(target_os = "windows")] + let data_dir = home_dir.join("AppData").join("Roaming").join(package_name); + #[cfg(target_os = "linux")] + let data_dir = home_dir.join(".config").join(package_name); + if !data_dir.exists() { + std::fs::create_dir(&data_dir) + .unwrap_or_else(|_| panic!("can't create dir {}", data_dir.display())); + } + data_dir }; - #[cfg(target_os = "windows")] - let data_dir = home_dir.join("AppData").join("Roaming").join(package_name); - #[cfg(target_os = "linux")] - let data_dir = home_dir.join(".config").join(package_name); - if !data_dir.exists() { - std::fs::create_dir(&data_dir) - .unwrap_or_else(|_| panic!("can't create dir {}", data_dir.display())); - } + #[cfg(target_os = "macos")] + let data_dir = std::path::PathBuf::new(); data_dir } -pub fn get_window(app: &mut App, config: PakeConfig, data_dir: std::path::PathBuf) -> Window { +pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: std::path::PathBuf) -> Window { let window_config = config.windows.first().unwrap(); let user_agent = config.user_agent; let url = match window_config.url_type.as_str() { @@ -240,7 +253,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, data_dir: std::path::PathBu .user_agent(user_agent.macos.as_str()) .resizable(window_config.resizable) .fullscreen(window_config.fullscreen) - .transparent(window_config.transparent) + // .transparent(window_config.transparent) .inner_size(window_config.width, window_config.height) .initialization_script(include_str!("pake.js")); @@ -252,7 +265,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, data_dir: std::path::PathBu let user_agent = user_agent.windows.as_str(); WindowBuilder::new(app, "pake", url) .title("") - .data_directory(data_dir) + .data_directory(_data_dir) .resizable(window_config.resizable) .fullscreen(window_config.fullscreen) .user_agent(user_agent)