clearlysid / tauri-plugin-decorum

Opinionated window decoration controls for apps built with the Tauri framework.
https://crates.io/crates/tauri-plugin-decorum
MIT License
138 stars 10 forks source link

Unable to get working with Fresh Tauri v2 RC #20

Closed stolinski closed 3 weeks ago

stolinski commented 1 month ago

I made a reproduction here: https://github.com/stolinski/decorum-reproduction

I tried to follow your /example code exactly, but also tried the code within the readme. Not sure what I'm missing here, but I the drag areas aren't within the DOM.

If you have any ideas, lmk, I've tried tweaking a ton to get it like your example, and I'm wondering if it's something sveltekit related or something that's changed from beta to rc.

Thank you for your work!

stolinski commented 1 month ago

Some additional information. I uncommented decorum-page-load event received and it is logging. But also when I tried your example within the /example dir, it did work correctly.

stolinski commented 1 month ago

Another small update. I can confirm that titlebar.js is not being run for some reason. I added the script manually to my index.html file and drag is now working without issue since the element wasn't being created. So not sure what's changed here or what I'm missing but

            let script_tb = include_str!("js/titlebar.js");

            win2.eval(script_tb)
                .unwrap_or_else(|e| println!("decorum error: {:?}", e));

Seems to be the issue for some reason.

metkm commented 1 month ago

Do you get any errors printed on the console or anything? I don't get anything at all.

Edit: I Had to add withGlobalTauri: True to the tauri config. It also logs error to the dev tools console but I was kinda blind I guess

clearlysid commented 3 weeks ago

@stolinski did you try @metkm's solution? Since the titlebar js is not working it's very likely what he suggested or a permissions issue.

ChaserZ98 commented 3 weeks ago

@clearlysid I faced the same issue. I can confirm adding the withGlobalTauri: True to the tauri config solve the problem. According to v2 doc, it seems window.__TAURI__ is not exposed anymore unless you set withGlobalTauri: True.

clearlysid commented 3 weeks ago

Thanks for the confirmation! This instruction is now also added to the docs, so hopefully it will be clearer to folks using it. In the meantime, I will explore options to try and remove this limitation. Cheers!