[Solved] Mute notifications

Often I need to subscribe to web apps with a high volume of notifications, which are sometimes very essential but at other times very distracting. I know I can mute certain sites by pressing the “Settings” button on the notification and disable the messages in my browser (chromium), but is there also a system wide way to (temporary) disable all notifications?

Yes.

Press the Windows key o click on the Mabox menu, then look for Notifications (it points to xfce4-notifyd). From there you can find what you need (ie. Do not disturb, etc).

Give it a try and tell us how it went please.

Great! That’s exactly what I was searching for. Is there maybe a way to add an icon for this in tint2, or add an entry to the left side panel?

As a preliminary ‘solution’ insert these lines into
~.config/openbox/rc.xml

    <keybind key="A-n">
      <action name="Execute">
        <command>xfce4-notifyd-config</command>
      </action>
    </keybind>

and then click enable/disable notifications
A-n is for Alt + n or select any free shortcut combination
(attn @biemster)

Entry for menu or left/right panel will look like:

Notifications,xfce4-notifyd-config,xfce4-notifyd

Syntax is:

Label,command,icon

icon is optional and it is not used by left-side panel

For tint2 you can add command somewhere to existing buttons. You can bind 5 actions to every button:

  • left click
  • right click
  • middle click
  • mouse whell up
  • mouse whell down

Or create new button for this.

Thanks all, very helpful. I realize I was not specific enough in my follow-up question, I tried to ask if there is a specific command (flag/param) for xfce4-notifyd to just toggle the mute, without opening the config and clicking the button.
But your suggestions will do great! Thanks!

I’m going to try to whip up a small python thing that interacts directly with d-bus, something like this:

#!/usr/bin/env python3
import dbus

obj = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
obj = dbus.Interface(obj, "org.freedesktop.Notifications")
obj.Notify("", 0, "", "Hello world", "This is an example notification.", [], {"urgency": 1}, 10000)

I guess this is what xfce4-notifyd-config does as well?

Ok the python route was a dead end, my assumptions were incorrect. But going through the xfce4-notifyd-config source and adjusting my google-fu to that, I found this gem:

xfconf-query -c xfce4-notifyd -p /do-not-disturb -T

which toggles the setting from command line!
Setting it specifically on or off is done like this:

xfconf-query -c xfce4-notifyd -p /do-not-disturb -s true
xfconf-query -c xfce4-notifyd -p /do-not-disturb -s false

This is exactly what I need, going to mark this solved.
Thanks everyone!
(source: xfce4-notifyd's Do Not Disturb from command line? / General discussion / Xfce Forums)

1 Like

To get this in the tint2 panel:

#-------------------------------------
# Executor 2, do-not-disturb
execp = new
execp_command = ~/.config/tint2/scripts/donotdisturb
execp_interval = 1
execp_has_icon = 0
execp_cache_icon = 0
execp_continuous = 0
execp_markup = 1
execp_monitor = all
execp_tooltip = L: Toggle Do Not Disturb
execp_lclick_command = xfconf-query -c xfce4-notifyd -p /do-not-disturb -T
execp_rclick_command = 
execp_mclick_command = 
execp_uwheel_command = 
execp_dwheel_command = 
execp_font = Symbols Nerd Font 14
execp_font_color = #deddda 100
execp_padding = 2 2
execp_background_id = 7
execp_centered = 1
execp_icon_w = 0
execp_icon_h = 0

And ~/.config/tint2/scripts/donotdisturb:

#!/bin/bash
# Tint2 xfce4-notifyd /do-not-disturb executor

status=$(LANG=C xfconf-query -c xfce4-notifyd -p /do-not-disturb -v)

if [[ $status = "false" ]]; then
    echo "🖅"
else
    echo "🖾"
fi
3 Likes