Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-11-19 17:13:21

Friedrich
Member
Registered: 2016-09-18
Posts: 137

[SOLVED] Disable notification for a specific app using command line

Can i disable the notification (xfce4-notifyd) using the command line for a specific app? I only found the do-not-disturb function but this disables all notifications for all apps.

Last edited by Friedrich (2023-11-21 23:37:44)

Offline

#2 2023-11-19 22:01:52

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,205

Re: [SOLVED] Disable notification for a specific app using command line

Depending on the version of xfce4-notifyd, it uses the xfconf property "/applications/muted_applications":

xfconf-query -c xfce4-notifyd -p /applications/muted_applications

Unfortunately, it is an array.

If the the application you want muted is the only application you want muted, it is simple:

xfconf-query -c xfce4-notifyd -p /applications/muted_applications -s "APPLICATION_NAME" -a

...replace "APPLICATION_NAME" with the actual application name as identified by xfce4-notifyd in it's properties "applications" tab.

If there are multiple applications involved, xfconf-query doesn't include functionality to insert or delete from arrays (the above command will overwrite any existing array), so you'll need to program something to do that (ie. save existing array members and recreate with additional new array member).


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2023-11-20 14:13:46

Friedrich
Member
Registered: 2016-09-18
Posts: 137

Re: [SOLVED] Disable notification for a specific app using command line

There is an error

Property "/applications/muted_applications" does not exist on channel "xfce4-notifyd". If a new property should be created, use the --create option.

Other people had the same problem when they tried to toggle do not disturb. The problem was solved with this

xfconf-query --channel xfce4-notifyd --create --property /do-not-disturb --set true

but this doesn't work for me.

xfce4-notifyd version is 0.9.3

If there are multiple applications involved, xfconf-query doesn't include functionality to insert or delete from arrays (the above command will overwrite any existing array), so you'll need to program something to do that (ie. save existing array members and recreate with additional new array member).

How can i read and write the array?

Offline

#4 2023-11-20 17:08:35

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,205

Re: [SOLVED] Disable notification for a specific app using command line

There is an error

If the property doesn't exist, you can either go into xfce4-notifyd settings, to the Applications tab, and toggle one of the application's "mute" settings. This will force the property to be created. Or:

xfconf-query -c xfce4-notifyd -p /applications/muted_applications -t string -s "APPLICATION_NAME" -a --create

How can i read and write the array?

Consider the following with 2 muted applications:

$ xfconf-query -c xfce4-notifyd -p /applications/muted_applications 
Value is an array with 2 items:

notify-send
org.freedesktop.network-manager-applet

To add "thunar" to this list, I would need to:

xfconf-query -c xfce4-notifyd -p /applications/muted_applications -t string -s "notify-send" -t string -s "org.freedesktop.network-manager-applet" -t string -s "org.xfce.thunar" -a

To then delete thunar from the list:

xfconf-query -c xfce4-notifyd -p /applications/muted_applications -t string -s "notify-send" -t string -s "org.freedesktop.network-manager-applet" -a

Notice how the array always needs to be recreated to preserve existing values.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2023-11-21 23:37:02

Friedrich
Member
Registered: 2016-09-18
Posts: 137

Re: [SOLVED] Disable notification for a specific app using command line

OK, thanks for the help.

Offline

Board footer

Powered by FluxBB