Closed Werner1201 closed 4 years ago
Well I discovered the problem, If I bring the image to the target/debug and make it directly from the name of the file It works. Now the question is why the library does not accept the Absolute path of the file
I just tested on mine with the complete path of the image and it worked.
I think maybe the issue is that you're missing a :
in your path:
D:\\pactw\\RustProjects\\teste_sys_tray\\temp.png
Okay, it worked adding the : but I have another question. How do I set the icon from a buffer and which type of buffer ? Because I'm using the Image library to generate images but the Image buffer that it generates isn't read by this crate
Em sex, 14 de ago de 2020 09:37, Rafael Merlin notifications@github.com escreveu:
I just tested on mine with the complete path of the image and it worked.
I think maybe the issue is that you're missing a : in your path: D:\pactw\RustProjects\teste_sys_tray\temp.png
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qdot/systray-rs/issues/49#issuecomment-674053599, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB3K2KML6UNKSYABRWXMVLSAUVY7ANCNFSM4P3B6BGA .
I personally used the set_icon_from_buffer() function and a buffer set with the include_bytes! macro (because I embed the icon in the binary) but this function seems to work only with .ICO data.
let enabled_icon = include_bytes!("../assets/checkmark.ico");
app.set_icon_from_buffer(enabled_icon, 128, 128)?;
Okay I'll try that, but I think it'll not be as optimized as I thought. Because I'm using a request to a weather API and then creating an image with the temperature then setting this icon to the systray. What I'm seeking is to eliminate the need to create the file and only use things internally. The link to my project is here if you want to help me, I'm learning the language with this project since it uses various concepts of the language
Em sex, 14 de ago de 2020 10:26, Nicolas BAUW notifications@github.com escreveu:
I personally used the set_icon_from_buffer() function and a buffer set with the include_bytes! macro (because I embed the icon in the binary) but this function seems to work only with .ICO data.
let enabled_icon = include_bytes!("../assets/checkmark.ico"); app.set_icon_from_buffer(enabled_icon, 128, 128)?;
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qdot/systray-rs/issues/49#issuecomment-674073886, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB3K2MLUZ6FGMQULQMA2MDSAU3Q3ANCNFSM4P3B6BGA .
As @nicolasbauw has already helped me in my project I will be closing this issue. If you want to Check out the solution, check my project here: (https://github.com/Werner1201/weather_tray-rs)
I've been trying to set a temp.jpg as the Icon on the example It always gives to me a "OS Error" on the debugger. here's my code: