Thunar does not honor sound theme setting
Version information
4.21.5-dev-8145ef6d
Manjaro
Steps to reproduce
- Install a sound theme which contains at least a trash-empty sound (I chose linux-a11y)
- Enable that sound theme as /Net/SoundTheme/Name (e.g. via xfce4-settings-editor) and make sure even sounds are enabled (e.g. in the Appearance settings pane)
- If your trash is empty, put an item into it (create one for that purpose if needed)
- Open the trash can
- Select "empty trash" from the bottom
Current behavior
the default (freedesktop) sound theme's sound is played
Expected outcome
the selected sound theme's sound is played (you might want to use canberra-gtk-play -i trash empty from the shell for comparison)
Additional information
I had failed to realize that ca_context_play does not honor the sound theme selection, so apparently the application has to explicitly query the setting and select the current sound theme.
Plank-reloaded, which also recently added libcanberra support, ran into the same issue. This is how it was fixed there: https://github.com/zquestz/plank-reloaded/commit/506f5b737a75707c8159934169ecc24f9569a287
Note that for an application like Thunar, which to my knowledge is supposed to run within XFCE only, maybe a different, more XFCE-specific way of querying the settings might be preferable.
Unfortunately I have been unable to come up with a good sample code for using libcanberra in an application, which should include checking for the selected sound theme (as well as whether event sounds are enabled at all).