6

Running 16.04 with Unity, after every log-in I see this annoying notification bubble in the top right corner of the screen that there are updates available.

This is not only annoying, but often it is not even true, as I'm holding back some packages which should not get upgraded, but the notifier seems not to care.

How can I disable those notifications for available updates?

I do not want to disable notify-osd completely. Also, I have already disabled automatic checking for updates as I'm doing that manually using apt anyway.

  • could you give an example of the message. is there an identifying string in it? – Jacob Vlijm May 17 '16 at 20:33
  • This isn't really an answer, but you can run killall notify-osd to kill that one particular popup. – wjandrea May 17 '16 at 20:41
  • 2
    That's a gnome-software thing. Happens all the time on Arch Linux with me, especially just after I'd upgraded packages using pacman -Syu. – muru May 17 '16 at 21:08
  • Byte, check /etc/xdg/autostart directory ! There should be an update service for that – Sergiy Kolodyazhnyy May 17 '16 at 23:36
9

According to this Fedoraforum.org post, you could try disabling GNOME Software's automatic downloading of updates:

gsettings set org.gnome.software download-updates false

The description of that key reads:

If enabled, GNOME Software automatically downloads updates in the background and prompts the user to install them when ready.

I don't have any updates on hand to test.

2

How to intercept (kill) only specific notifications, using dbus-monitor

You can automatically kill specific messages if you have a specific identifying string, which occurres in the notification's text. In this case, "update" will probably do.

How to setup

  1. Copy the script below into an empty file:

    #!/bin/bash
    
    string=$1
    match="update"
    
    if [[ $string == *$match* ]]
      then
        pkill notify-osd
    fi
    

    Save it as killnot.sh. This will kill notify-osd if a certain string occurres in the notification. Edit the line match="update" to reflect the identifying string in the notification(s) you'd like to kill. Make the script executable.

  2. Copy the script below into an empty file:

    #!/bin/bash
    
    scriptpath=/home/jacob/Bureaublad/killnot.sh
    
    dbus-monitor "interface='org.freedesktop.Notifications'" | \
    grep --line-buffered "string" | \
    grep --line-buffered -e method -e ":" -e '""' -e urgency -e notify -v | \
    grep --line-buffered '.*(?=string)|(?<=string).*' -oPi | \
    grep --line-buffered -v '^\s*$' | \
    xargs -I '{}' $scriptpath {}
    

    Edit the line scriptpath=/home/jacob/Bureaublad/killnot.sh to reflect the real path to script 1 (killnot.sh) and save it as monitor_notifs.sh. Make the script executable.

  3. Test-run the setup by the command:

    /path/to/monitor_notifs.sh
    

    To test, run in another terminal the command:

    notify-send <identifying_string>
    

    The mesasage should not appear.

  4. If all works fine, add it to your Startup applications: Dash > Startup Applications > Add. Add the command:

    /path/to/monitor_notifs.sh
    

Notes / explanation

The script monitor_notifs.sh uses dbus-monitor in the same way as this answer. Running it in the background means nothing to your system and only triggers notifications.

These notifications, when they occur, are passed as an argument to the script killnot.sh, which does nothing, unless the identifying string is in the notification's text. In that case it will kill notify-osd.

With a little editing of the first script, you can make the setup kill notifications on multiple keywords at once.


EDIT only run the command until the bubble appears

If the notification only appears after log in, as you mention in your question, you can "smarten" the solution up to kill itself after it intercepted the update notificalion:

If you named the scripts in the setup exactly as indicated, add one line to the killnot.sh sript:

pkill -P "$( pgrep -f run_intercept )"

The script then becomes:

#!/bin/bash
string=$1

match="update"
if [[ $string == *$match* ]]
  then
    pkill notify-osd
    pkill -P "$( pgrep -f run_intercept )"
fi

The main script, run_intercept, will then be killed after it did its job and you have no background script running anymore.

Closer to clean you cannot get in this situation imo.

  • You know that I always appreciate your answers, but I would really prefer a way that eliminates the cause, not the symptoms... – Byte Commander May 17 '16 at 21:38
  • 1
    @ByteCommander So would I. I'd use the dirty way however if that is not possible. Selectively disabling notifications depending on the source is currently not possible, unless from the application itself. The difference in this case is purely esthetically, not practically . – Jacob Vlijm May 17 '16 at 21:44
  • Jacob is correct. So far there is no way to disable notifications per application. You can only monitor dbus. There's actually already a dupe which he and i answered already. – Sergiy Kolodyazhnyy May 17 '16 at 23:30
  • I stick pkill update-notifier in my autostart (Openbox session, Lubuntu 16.04). But I check for updates myself at least twice a day. – DK Bose May 18 '16 at 2:26
  • @ByteCommander see my update. As close as it gets to clean I believe. – Jacob Vlijm May 18 '16 at 6:04
1

I found the file /etc/xdg/autostart/update-notifier.desktop , which autostarts the update-notifier service. As you may or may not know, any .desktop file in /etc/xdg/autostart directory will start whatever command is given by Exec= parameter.

All you have to do to disable it, is to do mv /etc/xdg/autostart/update-notifier.desktop /etc/xdg/autostart/update-notifier.desktop.bak and viola ! Re-enabling is the reverse.

  • I renamed the file, but the notification bubble came up again the next day. – Byte Commander May 21 '16 at 14:52
1

Bug fixed on last version of gnome(ubuntu)-software https://bugs.launchpad.net/ubuntu/+source/gnome-software/+bug/1592382

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.