Disable gnome-software's notification bubble (notify-osd) for available updates
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.
Solution 1:
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.
Solution 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
-
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 killnotify-osd
if a certain string occurres in the notification. Edit the linematch="update"
to reflect the identifying string in the notification(s) you'd like to kill. Make the script executable. -
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 asmonitor_notifs.sh
. Make the script executable. -
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.
-
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.
Solution 3:
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.
Solution 4:
Bug fixed on last version of gnome(ubuntu)-software https://bugs.launchpad.net/ubuntu/+source/gnome-software/+bug/1592382