10

I am running Centos 7 with GNOME-Shell 3.8.4.

I can happily disable all notifications from the top-right menu, as pictured:

disabling/enabling GNOME shell notifications via GUI

I need to do that from the command line, though, because I need to automate that in a script to trigger according to certain circumstances.

Is there any way to do that? Thanks all.

Dakatine
  • 2,748
  • 2
  • 15
  • 13

1 Answers1

12

Newer gnome-shell (~3.10+):

disable:

gsettings set org.gnome.desktop.notifications show-banners false

enable:

gsettings set org.gnome.desktop.notifications show-banners true

Note that you might need to enable/disable notifications also on a per-app basis, e.g. to disable Nautilus notifications:

gsettings set org.gnome.desktop.notifications.application:/org/gnome/desktop/notifications/application/org-gnome-nautilus/ enable false

and to re-enable them:

gsettings set org.gnome.desktop.notifications.application:/org/gnome/desktop/notifications/application/org-gnome-nautilus/ enable true

Old gnome-shell (<3.8 or 3.10):

disable:

gsettings set org.gnome.desktop.notifications enable false

enable:

gsettings set org.gnome.desktop.notifications enable true
Udi
  • 244
  • 2
  • 14
don_crissti
  • 2,804
  • 1
  • 20
  • 20
  • 1
    where do you find the relevant keys for these things? For instance, I used `gsettings list-keys org.gnome.desktop.notifications` to find keys, but I couldn't see any `applicaton`, let alone any hint on throwing in the whole `:/org/gnome/desktop/notifications/application/org-gnome-nautilus/` bit. This has always seemed like a mystery to me, much like the keys of `RegEdit` in Windows - although I know a lot more about navigating that! – oligofren Feb 15 '18 at 15:37
  • 1
    @oligofren - it's all in the manual (although not easy to figure it out)... this is a relocatable schema (to list all relocatable schemas use `gsettings list-relocatable-schemas`) so you need to provide a path for the schema in the format `SCHEMA [:PATH]` - you get the list of paths with stuff like `dconf list /org/gnome/desktop/notifications/application/ `. – don_crissti Feb 15 '18 at 16:44
  • Install dconf editor. It's like regex for gnome-based shells. – Evan Plaice May 03 '19 at 05:17
  • ...and for me to get rid of the current "printer added" notification which is blocking my video playlist call `pkill gjs` – Sridhar Sarnobat Apr 30 '22 at 19:32