GNOME Bugzilla – Bug 650172
RFE: Add an option for setting the sound theme
Last modified: 2018-01-24 15:04:18 UTC
Add an option for setting the sound theme for event sounds. It used to live in the control-center, but it was removed from there. The gsettings key is /org/gnome/desktop/sound/theme_name It should be set to the directory name of the theme. Sound theme specification: http://0pointer.de/public/sound-theme-spec.html It should be a dropdown box, with names of all installed themes (from the metadata file), when an item is clicked, the theme-demo sound should be played (see http://0pointer.de/public/sound-naming-spec.html). A label under the dropdown box could display the Comment field from the theme metadata file, which is usually used as a theme description. Implementing this feature would be much helpful for the fedora sound SIG, https://fedoraproject.org/wiki/SIGs/Sound I'll be happy to provide any additional information and assistance required to implement this feature. Thanks, Elad Alfassa.
*** Bug 596454 has been marked as a duplicate of this bug. ***
Created attachment 190493 [details] [review] Tweak freedesktop sound themes
Question about the patch: + def _play_sound(self, btn, cb): + uri = "file:///usr/share/sounds/freedesktop/stereo/message.oga" + + #FIXME: GLib.spawn_async is preferred, but broken + Gio.app_info_create_from_commandline( + 'gst-launch-0.10 -q playbin uri=%s' % uri, None, 0).launch([], None) What's the use of this? previewing the theme? If so, "freedesktop" should be replaced with the selected theme name. Thank you for making this patch! -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers
(In reply to comment #3) > Question about the patch: > + def _play_sound(self, btn, cb): > + uri = "file:///usr/share/sounds/freedesktop/stereo/message.oga" > + > + #FIXME: GLib.spawn_async is preferred, but broken > + Gio.app_info_create_from_commandline( > + 'gst-launch-0.10 -q playbin uri=%s' % uri, None, 0).launch([], > None) > What's the use of this? previewing the theme? > If so, "freedesktop" should be replaced with the selected theme name. Yeah, I was testing if this abuse of app_info was going to work. I'll finish this off sometime, and play the correct sound for the selected theme etc > > Thank you for making this patch! > > > > -- > Fedora Bugzappers volunteer triage team > https://fedoraproject.org/wiki/BugZappers
Maybe you should use canberra-gtk-play instead of gst-launch here, so that the sound played will be treated by pulseaudio as event sound and will be affected by the event sound volume configuration. [elad@elephant ~]$ canberra-gtk-play --help Usage: canberra-gtk-play [OPTION...] - canberra-gtk-play Help Options: -h, --help Show help options --help-all Show all help options --help-gtk Show GTK+ Options Application Options: -v, --version Display version number and quit -i, --id=STRING Event sound identifier -f, --file=PATH Play file -d, --description=STRING Event sound description -c, --cache-control=STRING Cache control (permanent, volatile, never) -l, --loop=INTEGER Loop how many times (detault: 1) -V, --volume=STRING A floating point dB value for the sample volume (ex: 0.0) --property=STRING An arbitrary property --display=DISPLAY X display to use libcanberra-gtk3-0.28-3.fc15.x86_64 : Gtk+ 3.x Bindings for libcanberra Repo : installed Matched from: Other : Provides-match: /usr/bin/canberra-gtk-play -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers
(In reply to comment #5) > Maybe you should use canberra-gtk-play instead of gst-launch here, so that the > sound played will be treated by pulseaudio as event sound and will be affected > by the event sound volume configuration. I had that first - but many people mute event sounds, so the preview would not be heard. On one hand those people would not want to change their sound theme anyway. On the other hand clicking preview and not hearing anything is surprising/confusing, and UIs should work on the principle of least confusion. What do you think?
I don't think that someone who muted his event sounds would like to change the sound theme, but putting it this way - using gst-launch sounds like the right option. -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers
(In reply to comment #7) > I don't think that someone who muted his event sounds would like to change the > sound theme, but putting it this way - using gst-launch sounds like the right > option. > > Oh, and BTW do you know where the "Mute Event Sounds" setting is stored?
I thought it's /org/gnome/desktop/sound/event-sounds but apparently it isn't, muting event sounds via gnome control center didn't change it. I have no idea where gnome control center saves this configuration, maybe directly in pulseaudio or something. -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers
Some comments on the patch (after having accumulated some experience in the past few months and suddenly remembering this bug existed: * Would make more sense to use pycanberra (right now used in gnome-clocks and pitivi) instead of gst-launch. Code is cleaner. https://github.com/psykoyiko/pycanberra Example code: try: import pycanberra has_canberra = True except ImportError: has_canberra = False if has_canberra: canberra = pycanberra.Canberra() canberra.play(1, pycanberra.CA_PROP_EVENT_ID, "complete-media", None) Apart from that, the spec suggests that if a theme has an index.theme but with Hidden=True inside it, we should not show it. If you want another implementation example, I implemented this CLI tool to do the same job: https://github.com/elad661/sound-theme-chooser/blob/master/sound-theme-chooser (easier to implement for me, because I am not familiar with the tweak-tool codebase).
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-tweaks/issues/16.