4

I use notify-send in Manjaro Linux to send notifications, as follows:

notify-send [OPTIONS] [Message Summary] [Message Body]

However, I moved to Pop! OS and I found that command not found: notify-send

I heard that notify-send is dead, so I am trying to get an alternative command to send notifications in Pop! OS

Is it also possible to install notify-send in Pop! OS?

AKMalkadi
  • 291
  • 3
  • 8
  • PoP! OS is based on Ubuntu. So whatever works on Ubuntu will work on Pop! OS. All you need to do is find out what particular package does that job in Ubuntu. – GMaster Jan 06 '22 at 02:39

2 Answers2

4

Actually, notify-send works fine in Pop! OS but just is not installed by default. There is no need for an alternative command. We just need to install libnotify-bin.

I was able to install and use notify-send successfully using the following command:

sudo apt install libnotify-bin
notify-send "Yes! It works!"
AKMalkadi
  • 291
  • 3
  • 8
3

As previously mentioned, you could install libnotify-bin and use notify-send. However, if you're looking for an out of the box solution to send notifications, you can use d-bus:

gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.Notify "YourAppName" "0" "Icon Path" "Notification Title" "Notification Message" "[]" "{}" 1500
  • The "0" you see there is a "Replaces ID", which makes this notification replace another one by its ID.
  • "[]" is the list of actions.
  • "{}" is a map of hints.
  • 1500 is the expiration timeout in milliseconds.

Example:

gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.Notify "YourAppName" "0" "/usr/share/icons/Pop/32x32/devices/battery.svg" "Battery low!" "Your <u>Zune</u>'s battery is less than <b>20%</b>" "[]" "{}" 1500

You generally only care about the icon, notification title, notification body, and the expiration time, but if you want to lear more, check out the docs: https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html