nikp123 / xava

X11 Audio Visualizer for ALSA
http://nikp123.github.io/xava
Other
129 stars 14 forks source link

[Feature Request] Pull colors from pywal #60

Closed make-42 closed 2 months ago

make-42 commented 2 months ago

This works...

make-42 commented 2 months ago

Closes #59

make-42 commented 2 months ago

I'll do my best!

nikp123 commented 2 months ago

I'll do my best!

Good luck and have fun

make-42 commented 2 months ago

I made all the changes you asked for except for the dynamic color reload part because I have no idea how to change the colors without triggering a whole reload.

nikp123 commented 2 months ago

I made all the changes you asked for except for the dynamic color reload part because I have no idea how to change the colors without triggering a whole reload.

Yeah because it isn't really obvious, I'd never thought of having code that redraws colors outside of the main loop, hence why a bit of architectural elbow grease is required unfortunately.

make-42 commented 2 months ago

something like this? it crashes here though (null pointer dereference) src/xava.c

58    output->func.clear(xava);
nikp123 commented 2 months ago

Funnily enough it doesn't for me, can you clear the compile cache, maybe somethings up.

make-42 commented 2 months ago

I'm on X11, that might be the issue. the clear function might be erroring out on x11.

nikp123 commented 2 months ago

There seems to be an bug with IONotify since it keeps calling non-stop.

make-42 commented 2 months ago

Maybe yes

nikp123 commented 2 months ago

Ok I found out whats the bug. Firstly you should actually check for an event instead of blindly reloading. Secondly the clear call seg faults on some systems because its supposed to be called from within the main thread (OpenGL moment).

We need an way to signal to the thread that we are redrawing. Exposing redrawWindow might be the solution here.

make-42 commented 2 months ago

What do you mean by checking for an event instead of blindly reloading?

make-42 commented 2 months ago

oh

make-42 commented 2 months ago

i get it

nikp123 commented 2 months ago

Anyway I fixed it, sending the patch soon enough

make-42 commented 2 months ago

Okay

nikp123 commented 2 months ago

fixes.patch.zip

nikp123 commented 2 months ago

Apply that patch, push here and I'll rebase

Additionally test out how it works for you.

nikp123 commented 2 months ago

Remove the glDrawArrays line I added by accident, it shouldn't be there

nikp123 commented 2 months ago

Actually don't, let me squash and merge this.

make-42 commented 2 months ago

okay

make-42 commented 2 months ago

It doesn't crash but doesn't update the colors either on X11 until a restart.

nikp123 commented 2 months ago

It doesn't crash but doesn't update the colors either on X11 until a restart.

Hm weird

nikp123 commented 2 months ago

It doesn't crash but doesn't update the colors either on X11 until a restart.

I've tested both X11 and Wayland, neither seem to have the issue on both Cairo and OpenGL

Can you send your config just in case?

make-42 commented 2 months ago

config

nikp123 commented 2 months ago

config

works even with that config :thinking:

make-42 commented 2 months ago

I'll do some investigation

make-42 commented 2 months ago

Okay. I fixed it. Line 18 of pywal.c it's ".cache" and not ".config" that should be used.

make-42 commented 2 months ago

It didn't register the file properly and probably read from xrdb on startup instead.

make-42 commented 2 months ago

fix.zip

nikp123 commented 2 months ago

@make-42 oh whoops, my bad

sent the patch to master

make-42 commented 2 months ago

Haha! Thank you!