Bluetooth headphones not working (Ubuntu 24.04 , built from source)

Hello everyone!
Some context:
I am using Ubuntu 24.04
I am using latest sonci pi , built from source
I am using a laptop (dell) connected to a monitor that has output that I am not using ever
I use my sony bluetooth headphones and they work fine with youtube for example

My problem:
When executing that first block of code from the tutorial, I can hear the beat from my laptop speakers , (if youtube is playing at the same time I can hear YT on headphones and sonic pi on laptop speakers)

How can I have sonic pi use my headphones? (already the selected audio output from my OS sound settings)

I have read quite a few threads in here but none seem to be enough (maybe I am not understanding them)

Thank you in advance!

One more bit of info, in case it helps with diagnosing
If I connect my headphones with a jack cable to my laptop, then sonic pi (even without restarting) sends the sound to my headphones just fine

It probably doesn’t switch audio devices automatically.
I don’t know if Ubuntu is running Pipewire or Pulse. If it’s Pipewire (or JACK), you can reroute the audio in qpipewire or qjack.