I don't think I'm the only one with more than one desktop installed. Nor is it the only one that configures all of its desktops differently. HoweverDoesn't it happen to you that sometimes components on one desktop launch on another without permission? That is the case with Xfce notifications, and I'll show you how to avoid it 🙂
HR Xfce notifications come in the package xfce4-notifyd, and one always wonders how do the happy notifications to appear everywhere. More when they don't have a file .desktop let me run them. The answer is simple: D-Bus. Some may have heard of it, as it is responsible for connecting many communications at the software level. Without going too far, D-Bus automatically launches the Xfce notification system at startup all desktops, to allow them to interact with it quickly.
What we are going to do is edit the service that tells D-Bus to always execute those notifications. Let's do this:
- We will copy is script, and save it with our preferred text editor. Save it however you want, but remember the name. I saved it as xfce-notifynot.sh.
- We give execution permissions to the script, either with a file explorer or with the command:
chmod +x nombre-script.sh
- We copy the script to / usr / bin /, for an easier and safer execution. We can use command:
sudo cp nombre-script.sh /usr/bin/
- We will edit the service D-Bus with a text editor. The file is located at: /usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service
- We will change the line that says: Exec = / usr / lib / xfce4 / notifyd / xfce4-notifyd to match the path of our script. It would look like this:
- We save and restart to better appreciate the change. Try different desktops with different notification systems, to make sure it works.
Some explanation about the script: what it does is check if the process is running xfce4-session, which only runs next to the desktop Xfce. That way the script confirms that it is being used Xfceand lanza notifications. As soon as we change the desktop, the script detects the change thanks to D-Bus y does not execute xfce4-notifyd. Life is more beautiful with scripts.
I hope you liked it, remember that you can leave suggestions and doubts in the comments 🙂 Greetings.