The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 1,885β€…    Votes:  3β€…    βœ… Solution
Tags: notification   bashrc  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/847624
Title: notify-send (alert) not popping-up GUI bubble messages
ID: /2016/11/10/notify-send-_alert_-not-popping-up-GUI-bubble-messages
Created: November 10, 2016    Edited:  June 12, 2020
Upload: May 12, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Aliases are automatically created in ~/.bashrc

When you look in ~/.bashrc you see these lines:

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

The problem with the code is the --urgency=low flag. Sometimes the message pops up, some times it doesn’t. After all it is low priority right?

To make the message always appear set the urgency to critical. Rather than changing the system default I created a new line for my own purposes:

# Add a "redalert" alias to pop-up on GUI desktop screens.  Use like so:
#   redalert "Weather update: It's raining Red States"
alias redalert='notify-send --urgency=critical -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

Now you can use:

redalert "Weather Update: It's raining Red States"

and it works perfectly!

⇧ Cut or limit internet connection to other wifi devices Vim editor, how can I save a file in other directory  β‡©