Customizing the Librem5 ringtone (works for Mobian too)

The Librem5 has a single ringtone included, and while it is nice, it is not aggressive enough for me, I wanted to customize it. So here is how I went about. The same will work for the Pinephone on Mobian which uses the same software stack, I think.

The terminology in this howto is quite confusing. So be aware that a 1) sound theme, a 2) feedback theme, and 3) feedback profiles are three different things.

1) The first one defines in which directories a sound file is looked up (the freedesktop theme will serve as fallback, if a sound is not defined). 2) The feedback theme connects event names and sound files (or visual/haptic feedback) and also defines various feedback profiles. 3) Those profiles are full, quiet and silent, providing profiles within a theme. OK, so let us get started and explain how to customize sounds. The testing it all section at the end of this blog post lets you easily test your results.

TL,DR; the quickie on the L5 / Mobian

#on the L5: as user purism
cp -pr /usr/share/sounds/librem5 ~/.local/share/sounds/mysound
mv YOURCOOLRINGTONE.ogg ~/.local/share/sounds/mysound/stereo/phone-incoming-call.oga
gsettings set org.gnome.desktop.sound theme-name mysound
# probably a reboot is needed...?!
#on Mobian: as user mobian
mkdir -p ~/.local/share/sounds/mobian/stereo
cp -pr /usr/share/sounds/freedesktop/index.theme ~/.local/share/sounds/mobian
mv YOURCOOLRINGTONE.ogg ~/.local/share/sounds/mobian/stereo/phone-incoming-call.oga
gsettings set org.gnome.desktop.sound theme-name mobian
# probably a reboot is needed...?!

Setting a sound theme

To check the current sound theme, issue:

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

On a Librem 5, the sound theme name will be “librem5“, which means that the default sound theme (src) installed at /usr/share/sounds/librem5 is being used. Go there, and check out the sounds in there, if you like. On the Mobian, the theme-name is simply set to “freedesktop“, ie no special theme-name has been set.

To create a new sound theme, I copied over the /usr/share/sounds/librem5 to /usr/share/sounds/spaetz (and renaming the theme in the index.theme file). If you want to do this as a local user, you can also place the directory in the ~/.local/share/sounds directory. Then set the sound theme to your new name, and you are done:

gsettings set org.gnome.desktop.sound theme-name YOURTHEMEDIRECTORNAMEYHERE

Once again, to check the currently set sound theme use: gsettings get org.gnome.desktop.sound theme-name

If all you wanted to achieve is to customize the sound, ie switch out sound files, you are done here. If you need to change the notifications or want to connect events and sounds in a different manner, read on.

Connecting Events and Sounds

feedbackd is used to connect events and feedback. The configured sound theme is used by the feedback theme definitions stored in /usr/share/feedbackd/themes/default.json which connects events to various types of feedback. Possible themes for various devices are in this src repo. And all possible event names are listed here. The docs however state that currently only a single hard coded feedback theme ‘default‘ can be used. So /usr/share/feedbackd/themes/default.json is the file to modify if you want to use a different sound name for an event, or let the vibrator vibrate longer (or shorter).

As an alternative to switching sound themes, in order to customize ringtones for instance, one could also connect e.g. the phone-incoming-call event to a different ogg sound file name (sound files usually use an .oga file suffix) and simply place that in the fallback directory at ~/.local/share/sounds/freedesktop. Modifying the effect name to your sound file name should be sufficient then (untested):

   {
      "event-name" : "phone-incoming-call",
      "type"       : "Sound",
      "effect"     : "phone-incoming-call"
    },

Although there is only a single feedback theme, it offers various feedback profiles, which is what we know as the normal, silent, vibrate-only profiles on other mobile phones. These can also be set and retrieved programmatically:

Feedback Profiles

In Settings->Notifications one can conveniently change the overall profile between loud and silent ones. Using the command line, you can use:

gsettings get org.sigxcpu.feedbackd profile
in order to retrieve the current profile and
gsettings set org.sigxcpu.feedbackd profile full|quiet|silent (one of the three possible values)
in order to set the current feedback profile. The description says:

full: Use configured events from the full, quiet and silent parts of the feedback them.

quiet: Use quiet and silent part from of the feedback theme. This usually means no audio feedback.

silent: Only use the silent part from the feedback theme. This usually means to not use audio or vibra.

Per app profiles

In Settings->Notifications one can conveniently change the profile also per application (so silence your chat messages but have loud sound when the alarm clock wants to go off).

Advanced stuff: One can set the feedback profile of an individual application via GSettings. E.g. for an app with app id sm.puri.Phosh to set the profile to quiet do:

gsettings set org.sigxcpu.feedbackd.application:/org/sigxcpu/feedbackd/application/sm-puri-phosh/ profile quiet

Testing it all

To simulate events and see/listen to the sounds use the fbcli utility (just fbcli will simulate an incoming phone call). The following (taken from the docs), will simulate an incoming message once:

fbcli -t -1 -E message-new-instant
# or play the alarm clock sound for 10 seconds:
fbcli -t 10 -E alarm-clock-elapsed

Note: while fbcli picked up a new sound theme immediately, a quick test on calling myself led to no ringtone sound at all. After a reboot, the new sound played fine. Please report if this was a glitch or seems to be the case indeed.

TODO: So what is the “Do not disturb” setting doing then 🙂
TODO: find out what happens when both /usr/share/sounds/librem5 and ~/.local/share/sounds/librem5 exist