Gnome 3 – Change the message notification duration

Recently at work I updated my box to Ubuntu 11.04. I really couldn’t handle Unity – so I installed Gnome 3… It took some time but now I like it.
I have pidgin installed and every chat message I get shows me a Gnome message notification for a couple of seconds. A nice, useful helper I would say. But I’m at work and some friends of mine have the terrible habit to write a new message for every single word they use. 🙂 When someone is starring at your screen at this time it’s quite uncomfortable…
After googling a bit I couldn’t find any solution to change the duration time of the notification. So I’ve found a solution on my own. I tested this on Ubuntu 11.04 and on my Arch Linux computer at home.
The gnome-shell GUI stuff is located in /usr/share/gnome-shell/js/ui.

# cd /usr/share/gnome-shell/js/ui

There you have to edit the messageTray.js file.

# vi messageTray.js

In the first 20 lines you find the variable ‘NOTIFICATION_TIMEOUT’. On my computer the default value was 4, later in the code we can find that this stands for a four seconds duration time. I changed it to 0.5 seconds. You can change it to whatever you like.

const NOTIFICATION_TIMEOUT = 0.5;

*Hint: You have to edit the file as root!
After doing all that you have to restart the gnome-shell.

$ gnome-shell --replace

This worked as expected the first time, the second time my desktop froze and I had to restart my computer…

3 thoughts on “Gnome 3 – Change the message notification duration

  1. Didn’t expect that they implemented stuff with javascript, but makes a lot of sense if you think about quickly adjust parameters.
    Keep up the good work 🙂
    Cheers
    mdc

  2. You made my day! I have been looking for this all alone for a similar but opposite reason. I want my notifications to be persistent. Now this helps me a lot. Thank you sir.

  3. You made my day! I have been looking for this all alone for a similar but opposite reason. I want my notifications to be persistent. Now this helps me a lot. Thank you sir.

Leave a Reply

Your email address will not be published. Required fields are marked *