After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 650172 - RFE: Add an option for setting the sound theme
RFE: Add an option for setting the sound theme
Status: RESOLVED OBSOLETE
Product: gnome-tweak-tool
Classification: Applications
Component: general
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Tweak Tool maintainer(s)
GNOME Tweak Tool maintainer(s)
: 596454 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-05-14 12:51 UTC by Elad Alfassa
Modified: 2018-01-24 15:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Tweak freedesktop sound themes (3.25 KB, patch)
2011-06-23 03:14 UTC, John Stowers
none Details | Review

Description Elad Alfassa 2011-05-14 12:51:06 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.
Comment 1 John Stowers 2011-06-23 02:19:00 UTC
*** Bug 596454 has been marked as a duplicate of this bug. ***
Comment 2 John Stowers 2011-06-23 03:14:58 UTC
Created attachment 190493 [details] [review]
Tweak freedesktop sound themes
Comment 3 Elad Alfassa 2011-06-23 06:00:41 UTC
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
Comment 4 John Stowers 2011-06-23 06:06:43 UTC
(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
Comment 5 Elad Alfassa 2011-06-23 06:12:15 UTC
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
Comment 6 John Stowers 2011-06-23 06:33:46 UTC
(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?
Comment 7 Elad Alfassa 2011-06-23 06:37:43 UTC
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
Comment 8 John Stowers 2011-06-23 06:39:04 UTC
(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?
Comment 9 Elad Alfassa 2011-06-23 06:50:52 UTC
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
Comment 10 Elad Alfassa 2012-11-17 13:43:43 UTC
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).
Comment 11 GNOME Infrastructure Team 2018-01-24 15:04:18 UTC
-- 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.