Skip to content

Strange behaviour with Volume and slider #396

@Titas-Lenkaitis

Description

@Titas-Lenkaitis

Describe the bug
I made a volume slider, and moving the slider around can cause the slider to start glitching and slides around by itself, seemingly switching between a few values. This bug does affect the actual volume, and not just the slider value. Sometimes it requires deliberate effort to trigger but at other times it happens when just using it normally

2025-08-16_15-50-00.mp4

To Reproduce
Make a slider with the value being binded to the volume of the default speaker and the onValueChanged setting the volume of the default speaker
drag it around

Expected behavior
Should be able to just drag the slider around like any normal slider without getting into some loop like that

Additional context
The chance of this bug occurring seems to have a few factors.
One is the refresh rate of the monitor. At 60Hz, this is much harder to pull off but at higher refresh rates it can happen naturally just trying to slide the slider normally

This also is a lot easier to trigger when using a Bluetooth speaker, making the bug far easier to trigger.

The slider code:

<slider
    roundDigits={2}
    value={volume}
    min={0}
    max={100}
    page={5}
    step={5}
    widthRequest={250}
    onValueChanged={(self) => defaultSpeaker.set_volume(self.value/100)}/>

volume is a binding to the current volume:
const volume = createBinding(defaultSpeaker, "volume").as((self) => Math.round(self*100))

and defaultSpeaker is just the default speaker
const defaultSpeaker = wp.get_default_speaker()

Although I use 0-100 scale for volume, and multiply/divide where I need to, this issue still occurs when using the normal values of 0-1 for volume, like the volume slider in the gtk4 example bar.

I've also tried using onChangeValue and onNotifyValue but they both have over issues
I've used this exact method for my brightness slider with no issue.
This issue occurs on my other device aswell

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions