Howto: enable Do Not Disturb mode with Indicator Notifications on Ubuntu MATE 18.04 LTS

Recently I have completed a migration of my personal systems from Ubuntu MATE 16.04 LTS to Ubuntu MATE 18.04 LTS.
This release is a good and still supported alternative for modern Ubuntu MATE 20.04 LTS, it includes Python 2 and Qt4 stuff which is needed for some of my applications.

But Ubuntu MATE 18.04 LTS lacks the well-designed and useful feature for broadcasting and screen sharing - Do Not Disturb for Indicator Notifications.
It was introduced later, in Ubuntu 19.10 and then included to 20.04 LTS.

The below method allows one to get both Do Not Disturb mode with Indicator Notifications while using packages from 20.04 LTS.
So we need to download packages manually and then install them:

cd ~/Downloads

wget http://archive.ubuntu.com/ubuntu/pool/universe/m/mate-notification-daemon/mate-notification-daemon_1.24.0-1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/m/mate-notification-daemon/mate-notification-daemon-common_1.24.0-1_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/i/indicator-notifications/indicator-notifications_0.4.2-0ubuntu1_amd64.deb

sudo apt-get install ./mate-notification-daemon-common_1.24.0-1_all.deb ./mate-notification-daemon_1.24.0-1_amd64.deb ./indicator-notifications_0.4.2-0ubuntu1_amd64.deb

Then logout (or reboot), login back and enjoy.

This will make available two checkboxes with Enable do not disturb - one inside Indicator Notifications settings:

ins

and one inside MATE Control Center → Popup Notifications:

mcc-ns

Technically they change two gsettings keys:

  • net.launchpad.indicator.notifications.do-not-disturb
  • org.mate.notification-daemon.do-not-disturb

To have one-click switch I have created custom script ~/bin/toggle_dnd.sh for DnD toggling.
The script maybe created in programmatic way by ececuting long command :

mkdir ~/bin
cat << EOF > ~/bin/toggle_dnd.sh
#!/bin/bash

gsettings get net.launchpad.indicator.notifications do-not-disturb | grep true && \
gsettings set net.launchpad.indicator.notifications do-not-disturb false && notify-send -t 1000 "Do not disturb disabled" || \
gsettings set net.launchpad.indicator.notifications do-not-disturb true

EOF
chmod +x ~/bin/toggle_dnd.sh

and then it should be linked to Custom Application Launcher as follows:

  1. Do right mouse click on needed MATE Panel
  2. Locate Custom Application Launcher applet and click Add
  3. Set Name to Toggle DnD
  4. Set Command to /home/username/bin/toggle_dnd.sh (change username to yours)
  5. Set Icon to the corresponding one, for example /usr/share/icons/hicolor/scalable/apps/mate-notification-properties.svg mate-notification-properties
  6. Click OK
  7. Try to toggle newly created launcher

This simple script is usable on modern versions of Ubuntu MATE too.


Notes. For me only one discrepancy exists - the Popper email notifier do not know about this DnD mode, and plays sound on e-mail arrival. Maybe I'll patch it in some way later.

2 Likes