notification sound for incoming mail?

Asked by valk on 2011-10-22

Would it be possible to add the possibility to select a notification sound for new mail?
I just came across this tool and like it a lot and being able to select a notification sound would make it even more perfect!

Question information

English Edit question
Unity Mail Edit question
No assignee Edit question
Solved by:
Dmitry Shachnev
Last query:
Last reply:
Best Dmitry Shachnev (mitya57) said : #1

I'll add an option to run a custom script on new mail arrival (too late for 0.9, most probably it'll land in 0.10), it'll be easy then to set any sound.

For now you can set a sound for all notifications in the System Settings.

valk (mpvalk) said : #2

Thanks Dmitry Shachnev, that solved my question.

Dmitry Shachnev (mitya57) said : #3

Now (with today's 0.9.2 release) you can set any command to execute on mail receive.

You can specify that command in "ExecOnReceive" option of the configuration file (just add a "ExecOnArrive=/full/path/to/script" line to "General" section of that file, it is located at ~/.config/unity-mail.conf). Sender and Subject are passed as command-line arguments.

You can create a script that will use "canberra-gtk-play --id=STRING" or "canberra-gtk-play --file=PATH" to play sounds.

Note: This won't be executed on startup/first-time check.

A GUI option will be available later.

Dmitry Shachnev (mitya57) said : #4
der-mali (thomas-h-will) said : #5


you said above:
"You can specify that command in "ExecOnReceive" option of the configuration file (just add a "ExecOnArrive=/full/path/to/script" line to "General" section of that file, it is located at ~/.config/unity-mail.conf). Sender and Subject are passed as command-line arguments."

When I open the said file the line starts with
ExecOnReceive =
and not with
ExecOnArrival =

Which is the correct one please?

Anyway both do not work for me after installing Ubuntu 12.04 anew (this is my problem, not yours, I still have to figure out why).

BTW: I deleted Unity and Compiz complety and run my Ubuntu in 2D mode.
Might this be the reason why I do not get a sound anymore?
I also deleted gnome-core and most gnome services.
Well, Unity 3D still needs a lot of improvements to run stable...

der-mali (thomas-h-will) said : #6

Maybe some packages are missing?
Here is the package info from gtkorphan:

Package: unity-mail
Status: install ok installed
Priority: optional
Section: mail
Installed-Size: 450
Maintainer: Ubuntu Developers <email address hidden>
Architecture: all
Version: 0.92.3~12.04
Depends: python3, python3-gi, xdg-utils, gir1.2-unity-5.0, gir1.2-notify-0.7, gir1.2-gtk-3.0, gir1.2-indicate-0.7, gir1.2-gnomekeyring-1.0
Suggests: indicator-messages
Description: Mail notifications and count for Unity
 Unity Mail is an application that integrates your mail into the Unity shell.
 It displays notifications about incoming mail, shows number of unread messages
 in the Unity Launcher and shows subjects in the Messaging Menu.
 The Unity Launcher item also has a quicklist that provides quick access to your
 mail folders (configured for GMail by default). It also allows you to quickly
 compose a new message.
 Unity Mail starts automatically, all you have to do is to enter your accounts
 settings in a configuration dialog.
Original-Maintainer: Dmitry Shachnev <email address hidden>

Dmitry Shachnev (mitya57) said : #7

ExecOnReceive is the right name, other name was a typo.

If it doesn't work for you, can you please click on "Create bug report" button and attach both your script and your unity-mail.conf?

Also, note that ppa:mitya57/ppa contains a slightly newer version of unity-mail than the repositories (1.1+bzr327), maybe it'll work with that version…

Dmitry Shachnev (mitya57) said : #8

By the way the version in Ubuntu raring (13.04) now has the "Play Sound" switch in the settings dialog, so if you are planning to upgrade at some point, you can just use that switch.

der-mali (thomas-h-will) said : #9

Nothing seems to work!
I am using Ubuntu 12.04 LTS

I tried to install Unity-Mail 1.3.1, I needed Python 3.2.3-3, my version was 3.2.3-2.
This step was successful.

Next dependency is the python-secretstorafe which I successfuly got from you ppa "test1".

After this two steps I was able to install Unity-Mail 1.3.1 on Ubuntu 12.04 and it started.
BUT: I was not able to access "Change Account Details" when right-clicking the launcher icon, so I was not able to set a WAV sound file.

No I am back to your suggested version 1.1.
Before I used only Ubuntu 2D and the packages "unity" and "compiz" were not installed.
Sound is usually working
I installed them back but still no sound :( :( :(

My config file looks like this:

Interval = 60
ExecOnReceive = /home/bubi/Desktop/
NotificationsHaveIcons = True
HideMessagesCount = True

The script:

canberra-gtk-play --file=newmail.wav

The file is set to "executable" under properties and permissions

der-mali (thomas-h-will) said : #10

I did a reinstall of Ubuntu 12.04 but there is still no sound.
I tried an actually "useless" command: "firefox" in the config file.
Command "firefox" works and opens the Firefox browser.
I will try with another command shich plays a sound, maybe not a wav-file but somthing else.
Maybe there is a problem with permissions but the system is new.
Strange thing is also that the same problem occurs on my netbook without a lot of changes done by me.
Very strange...

Dmitry Shachnev (mitya57) said : #11

I think you should specify a full path to "newmail.wav". If you don't specify it, it'll be searched for in the directory you started unity-mail from (in most cases your home folder).

Also, unity-mail >= 1.2 won't work on 12.04 as it needs new Messaging Menu from 12.10.

der-mali (thomas-h-will) said : #12

Hello Dmitry,

thank you for your patience with me!

There were a lot of small faults playing together but none was Unity-Mail's fault:

- you are correct: a full path to the sound file is required in the command (did so before but see next faults)

- I can not put the command "canberra-gtk-play --file=PATH" into the unity-mail.config file, I have to use the path to a script there.

- In System Settings -> Sound -> Sound Effects the Alert Volume was = zero (muted). This must have happened in a recent update.
  I can not imagine how it changed itself

- The command "play" which I used before instaed of the canberra command was not available anymore. Since this happended I played around with everything and messed it up completely.