Tauri

Alright, i decided to crate a suppport thread for this -as i have multiple questions. For starters i have migrated the app and the router from solid-start to solidjs with success. All of the previous issues i mentioned are now solved and working as expected. I have a new issue, two in fact. One major and one minor. I'll start with the major one. tauri uses data-params on the html elements to allow attaching certain html elements to the rust backend - this workedfine inreact. It not longer works as expected in solidjs. What i mean by this is the following. Take this example html:
<div class="main-div">
<div data-tauri-drag-region class="titlebar" style="position:relative; z-index:10">
<div class="titlebar-button" id="titlebar-minimize">
<img src="https://api.iconify.design/mdi:window-minimize.svg" alt="minimize" />
</div>
<div class="titlebar-button" id="titlebar-maximize">
<img src="https://api.iconify.design/mdi:window-maximize.svg" alt="maximize" />
</div>
<div class="titlebar-button" id="titlebar-close">
<img src="https://api.iconify.design/mdi:close.svg" alt="close" />
</div>
</div>
<div id="root"></div>
</div>
<div class="main-div">
<div data-tauri-drag-region class="titlebar" style="position:relative; z-index:10">
<div class="titlebar-button" id="titlebar-minimize">
<img src="https://api.iconify.design/mdi:window-minimize.svg" alt="minimize" />
</div>
<div class="titlebar-button" id="titlebar-maximize">
<img src="https://api.iconify.design/mdi:window-maximize.svg" alt="maximize" />
</div>
<div class="titlebar-button" id="titlebar-close">
<img src="https://api.iconify.design/mdi:close.svg" alt="close" />
</div>
</div>
<div id="root"></div>
</div>
This is all i should need to create a custom titlebar. Now, the titlebar renders correctly, however there is no functionality. I should be able to click on the html element, minimize for example, and it minimizes the app. This does not happen, in fact nothing happens. However, i can click and drag on the titlebar and move the window around - so that is one functionality that is working correctly. I can also resize the window, though resizing the window is much less responsive than it should be.
42 Replies
DaOfficialWizard🧙
The second issue i am facing, much lower on the proirity list, is that the window can not be made transparent. The body is black, no matter what i do. I need a transparent window so that i set the corners as rounded. I did this in the react version of my app by setting the body to no color and rounding the corners of a wrapper div in the html (main-div in the example above). This used to work, now it does not.
foolswisdom
foolswisdom•17mo ago
Regarding the titlebar, can you verify that the html rendered by solid (in the DOM) is the same (or different) than that rendered by react Regarding the second issue, something probably has a color set somewhere that shouldn't...
DaOfficialWizard🧙
since i made this post i have verified that the html is the same - the issue lies in the custom JS. in my react-app i use a custom.js file to register the button events. Seems i am not implementing this correctly for solid so, it's my mistake
REEEEE
REEEEE•17mo ago
I have done exactly what you're trying to do 😅 https://github.com/dev-rb/glass If you need reference for how to make it work
DaOfficialWizard🧙
cheers, thank you for the link This will help a lot xD okay, and i see my mistake Nice to know i got 99% of the way there though
REEEEE
REEEEE•17mo ago
what was the issue?
DaOfficialWizard🧙
i am not setting up the transparency correctly, and i was not setting the event listeners onMount seems you are using Solid itself to set the event listeners - i was trying to import a global script custom.js
REEEEE
REEEEE•17mo ago
ahh yeah that could be why
DaOfficialWizard🧙
actually, i just cloned your repo to test it your titlebar buttons do not work either
REEEEE
REEEEE•17mo ago
I think I didn't enable them 😅 I forgot about that
DaOfficialWizard🧙
ah, okay. That makes sense It's supposed to just render the titlebar, right? As you made the main window transparent?
REEEEE
REEEEE•17mo ago
I made the titlebar and window transparent from what I remember 🤔 Only the titlebar buttons are visible
DaOfficialWizard🧙
yeah, that's all i get. Flourescent yellow titlebar
REEEEE
REEEEE•17mo ago
You can right click on the titlebar
DaOfficialWizard🧙
alright, cool. neat - i like the menu design
REEEEE
REEEEE•17mo ago
oh oop I was testing stuff and left the yellow 🤦‍♂️
DaOfficialWizard🧙
ooooh, you smart cookie. You're using the winAPI on the rust side I was wondering about that as well
REEEEE
REEEEE•17mo ago
I tried 😅 It was very confusing I couldn't get exactly what I wanted so I kind of abandoned the project
DaOfficialWizard🧙
fair
REEEEE
REEEEE•17mo ago
I'll go back to it eventually but the winAPI was hurting my head after a few days
DaOfficialWizard🧙
tauri is really awesome - but super finicky. I am trying to use it to teach myself front-end design. I am used to c++ and rust backend.
REEEEE
REEEEE•17mo ago
It was my first project with tauri I mostly used electron
DaOfficialWizard🧙
i hear that - its a nightmare i want to like electron .... but i dont xD lmfao tried it so many times
REEEEE
REEEEE•17mo ago
Tauri didn't exist when I started playing around with desktop apps So electron was good enough Plus, rust is scary 😂
DaOfficialWizard🧙
still is, i have nothing bad to say - don't know it well enough. I just always found it super bloated and annoyed that it packaged chromium everytime i tried to build an app but those are personal gripes
REEEEE
REEEEE•17mo ago
Honestly, it can be an advantage to have chromium shipped with it You can use chrome apis that don't exist in other browsers
DaOfficialWizard🧙
🤔 fair point, you are not bound to browser support issues
REEEEE
REEEEE•17mo ago
I needed local font access for a previous project and since I was using electron and because chromium was shipped with it, I had access to the Local Fonts Access api If it was tauri, I wouldn't have had that access
DaOfficialWizard🧙
yeah, that is true. Tauri does expose the browser native api's - but you,as the dev, have to be aware of the browser your app is intended to run in For me, i havent explored beyond windows (yet) - so accessing Edge's apis from webView hasn't been too bad.
REEEEE
REEEEE•17mo ago
Same here
DaOfficialWizard🧙
I'll try electron soon with a fresher mindset. I do like rust though xD - hard to move away from rust for me.
REEEEE
REEEEE•17mo ago
I need to learn rust but I haven't found a use case for it yet Also, I just pushed changes to add the functionality for the titlebar and fix the color issue
DaOfficialWizard🧙
i work in embedded development - so it's a given for me.
REEEEE
REEEEE•17mo ago
Yeah that's what I want to learn it for, but I haven't started working with embedded tech yet soon though
DaOfficialWizard🧙
will pull now, thanks again.
REEEEE
REEEEE•17mo ago
np
DaOfficialWizard🧙
Ah, no more flourescent yellow screaming at me. woah o.o the always on top setting is super funky haha- i assume it's not supposed to behave like that, but interesting none the less
REEEEE
REEEEE•17mo ago
Oh, the always on top is intended. The window should be above everything else
DaOfficialWizard🧙
mm, it is, but you can't click on anything inside of the window
REEEEE
REEEEE•17mo ago
Yeah I couldn't figure that part out 😅 That's what I was trying to figure out with the win api Technically I had it so you could click through the window but I was trying to figure out how to isolate the titlebar so you could at least drag it around too But the only way to do it was through hotkeys but I also wanted a way for the user to use the mouse
DaOfficialWizard🧙
yeah, now that's some complex UX i like the vision
REEEEE
REEEEE•17mo ago
thanks 😄