Ubuntu – Symlink for Currently Selected Alert Sound

18.04sound

Is there a symlink or other way to get the path to the currently selected alert sound (as selected through the main settings)? I'm looking to have my Tunderbird new mail sound match my alert sound, and don't want to have to worry about selecting the new sound when I change it in the main settings.

Best Answer

  • Workaround

    Seems there are no schemas for setting the alert sound options those are available via GUI

    enter image description here

    Observations:

    Sound theme can be set with gsettings

    gsettings set org.gnome.desktop.sound theme-name 'mySoundTheme'
    

    to see the current theme.. run gsettings get org.gnome.desktop.sound theme-name

    Example:

    $ gsettings get org.gnome.desktop.sound theme-name
    'ubuntu'
    $ 
    

    when Bark is selected from the GUI, It uses same ubuntu theme but instead of the file /usr/share/sounds/ubuntu/stereo/bell.oga it uses /usr/share/sounds/gnome/default/alerts/bark.ogg

    when Drip is selected it uses drip.ogg, in the same way for Glass and Sonar also.

    In all the above 4 Selections, the system sound theme is constant which is ubuntu which is used by the Thunderbird.

    enter image description here

    When the option "Default system sound for new mail" is selected in Thunderbird it uses message.ogg file for new mails and bell.ogg file for alerts from the custom theme

    Note that the names in some custom downloaded themes may vary for message.ogg and bell.ogg etc..

    So the idea is to create 4 Custom Sound Themes with name bark, drip, glass & sonar..

    to do so, just copy ubuntu directory and rename it with above names..

    replace the files message.ogg and bell.ogg with the sounds you wish in all the four directories bark, drip, glass & sonar..

    now you can choose the custom theme you want with gsettings command or via dconf-editor tool which can be installed with sudo apt install dconf-editor

    gsettings set org.gnome.desktop.sound theme-name 'bark'
    gsettings set org.gnome.desktop.sound theme-name 'drip'
    gsettings set org.gnome.desktop.sound theme-name 'glass'
    gsettings set org.gnome.desktop.sound theme-name 'sonar'
    

    If you want to reset, run below command

    gsettings reset org.gnome.desktop.sound theme-name
    

    to remove the options from GUI for any accidental selection of "Choose an alert sound"

    rename the file /usr/share/gnome-control-center/sounds/gnome-sounds-default.xml to anything you wish..

    enter image description here

    enter image description here

    Tested in Ubuntu 18.04.2, Worked as intended.