I'm on Ubuntu 18.04. I did a clean install, all is nice and quite stable, but I can't see urgent notifications in fullscreen mode (es. YouTube videos in Google Chrome, movies on MPV, Totem or VLC). I tried using --urgency-critical
and -u critical
, and I saw they're working in normal use as I have to click on the X button to remove them, but this command doesn't put them on top like in 17.10. I don't understand if it's a Gnome Shell bug or I have to do something new.
It's really annoying because I don't see the battery low notification and my laptop switches off everytime I watch a movie. I have to control myself, not comfortable, really.
Anyone knows a workaround or something?
Asked
Active
Viewed 1,262 times
3

np_3ka
- 544
- 3
- 6
- 22
1 Answers
2
Yes this is very annoying. For workaround, I use zenity
's warning
dialog-box. It has the benefit of popping up even over full-screen applications:
zenity --warning --text='Battery Low' --no-wrap
Getting the current battery percentage programmatically via script is very easy, but will require a little bit of research on your part, because of variability among systems and manufacturers. Start from here.
Here is my script setup:
This is batteryLevel.sh :
#!/bin/bash
upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | sed -r 's/[^0-9]*([0-9]+).*/\1/'
This is batteryStatus.sh :
#!/bin/bash
upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep state | sed -r 's/.*\:\ +(.*)/\1/'
Finally, this is batteryInfoNotify.sh :
#!/bin/bash
upperThreshold=99
lowerThreshold=20
echo upperThreshold=$upperThreshold
echo lowerThreshold=$lowerThreshold
zenity --info --text='Battery level monitoring started...' --no-wrap 2>&1 >/dev/null
while [[ true ]]; do
status=$(~/Scripts/batteryStatus.sh)
level=$(~/Scripts/batteryLevel.sh)
msg="Battery Level now is $level%"
echo "Battery $level% and $status"
case $status in
charging | fully-charged)
if [[ $level -gt $upperThreshold ]]; then
echo 'Upper threshold crossed...'
zenity --warning --text="$msg" --no-wrap --timeout=8 >/dev/null 2>&1
espeak -v en+m7 -p 60 "$msg"
fi
;;
discharging)
if [[ $level -lt $lowerThreshold ]]; then
echo 'Lower threshold crossed...'
zenity --warning --text="$msg" --no-wrap --timeout=8 >/dev/null 2>&1
espeak -v en+m7 -p 60 "$msg"
fi
;;
*)
echo unexpected battery status
;;
esac
sleep 30s
done
All of these are in my ~/Scripts
and batteryInfoNotify.sh
is called at session startup everytime because I set it up so in GNOME Startup Appications
.

AneesAhmed777
- 230
-
very good answer, really useful ! – damadam Jun 14 '18 at 08:00