Always on top notifications

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
djtlumic

Always on top notifications

Post by djtlumic »

Hi there,

its possible to have always on top notificaions even in fullscreen mode? Playing movies,gaming etc.

Its critical to know low battery etc. I dont find any solution on web yet.

Any advices please? Also i think this function is important to any user on laptop.

Mint Cinnamon 17.3 up to date. Also tried 18.3/19 live cd, same result.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Always on top notifications

Post by smurphos »

Give this alternative battery/power applet a try.

https://cinnamon-spices.linuxmint.com/applets/view/255
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
djtlumic

Re: Always on top notifications

Post by djtlumic »

thanks for advice. App works and i get really hard notifications even in fullscreen game. But due to apps refresh rate,games and etc. gets laggy. Not good solution :/
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Always on top notifications

Post by smurphos »

If you can reliably reproduce performance issues with the applet please do report it as an issue - the author is active in maintaining and improving his applets. See https://github.com/linuxmint/cinnamon-s ... IBUTING.md

In the meantime as another workaround you could try running a background script....I've thrown this together this morning - so very limited testing and it might need tweaking but I'm pretty sure this will produce a persistent notification even over full screen video/games. You'll need to save the script on your system, i'd suggest in ~/bin, make it executable and then set up a start-up job via Startup applications to run it. Note it will probably fail if you've got a natty system with multiple batteries.

Just noticed that you are on 17.3 - not sure if upower is used in 17.3? This has been tested on 19.

Edit - script updated to use a zenity warning rather than a notification. apt install zenity to get zenity.

Code: Select all

#!/bin/bash

#Script send persistent notification on low battery events
#Find battery
if upower -e | grep battery; then
	BATTERY=$(upower -e | grep battery)
else
	echo "Error could not find battery"
	exit 1
fi

# Start loop
while true; do
STATE=$(upower -i "$BATTERY" | grep -E state|xargs|cut -d' ' -f2|sed s/%//)
if [ "$STATE" != "discharging" ]; then
    STATUS="OK"
	sleep 1m
	continue
else
	LEVEL=$(upower -i "$BATTERY" | grep -E percentage|xargs|cut -d' ' -f2|sed s/%//)
	if [ "$LEVEL" -gt 20 ]; then
		STATUS="OK"
		sleep 1m
		continue
	elif [ "$LEVEL" -le 10 ] && [ "$STATUS" != "Critical" ] ; then
		zenity --warning --text="Battery Critically Low - $LEVEL%" --width=150
		STATUS="Critical"
		sleep 1m
		continue
	elif [ "$LEVEL" -le 20 ] && [ "$STATUS" != "Low" ] && [ "$STATUS" != "Critical" ]; then
		zenity --warning --text="Battery Low - $LEVEL%" --width=150
		STATUS="Low"
		sleep 1m
		continue
	fi
fi
sleep 1m
done
Last edited by smurphos on Fri Feb 01, 2019 4:48 am, edited 3 times in total.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
djtlumic

Re: Always on top notifications

Post by djtlumic »

edit
djtlumic

Re: Always on top notifications

Post by djtlumic »

hi there,after some testing i have to say that script isnt working properly.

Sometimes notification pops up, sometimes dont,sometimes it dont show at all. ( videos firefox,gaming wine ) , system notification even with script turned off dont show anymore,even in window mode only ( set levels in dconf - cinnamon-power)

i make uprade from 17.3->18.3 before testing.

Is there something i can post so you could know what is happening?
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Always on top notifications

Post by smurphos »

The native notifications you can set to use a time based policy or a percentage based policy using dconf / gsettings. I've never changed them as I don't run my machine on battery very often but time based notifications are working for me. If you are messing with the percentages in dconf be sure to turn off time based notifications to be alerted purely on percentage grounds.

These shots are from the Mint 19 version of dconf-editor - the keys are all present and correct in 18.3 though. Note the blurb implies that time based notifications won't work on some hardware.

Image

Also double check you've got Notifications enabled in the Notification app. Turning on Notification sounds in the Sounds settings app is also helpful for the native notification.

If you've upgraded versions probably worth giving the BAMS applet another go - you might find the performance issues are gone.

As to the script - I wasn't 100% sure if notify-send would cut through to full screen but it appears it doesn't or doesn't in all full screen cases.

Please check the following.

1) Does running notify-send --urgency=critical --icon=battery-low-symbolic "Can you see me?" in a terminal produce a notification? If not you probably need to install lib-notify - apt install libnotify-bin

2) Once confirmed notify-send works please try this sleep 5m && notify-send --urgency=critical --icon=battery-low-symbolic "Can you see me?" and then open some full screen activity - do you get a notification over the full screen activity after 5 minutes. Please repeat with various activities.

3) If that's a no go give zenity a try - apt install zenity - then repeat the tests from 2 but using the command sleep 5m && zenity --warning --text="Can you see me?" --width=150
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Always on top notifications

Post by smurphos »

Edit - I've just dug up an old game and given these a try - zenity is the way to go.

I've updated the script above....
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
djtlumic

Re: Always on top notifications

Post by djtlumic »

Hi there, after some time of testing i have to say that disable time policy helps for system warning.

Both system warning and your script works,but halfway.

From reboot (maybe even when suspended to RAM, not sure, my GF uses a laptop ) ,first warning you cant see in fullscreen.after minimize/unfullscreen other warnings works like they should. cant be this fixed?

Zenity is terrible window warning :/

Same system Linux Mint 18.3

Thank you
User avatar
smurphos
Level 18
Level 18
Posts: 8501
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Always on top notifications

Post by smurphos »

djtlumic wrote: Thu Jan 31, 2019 7:29 pm Zenity is terrible window warning :/
I'm not aware of other good options if you want the warning to cut through a full screen app without doing it via an applet /extension and using Cinnamons' native modal dialogs.

This is what the BAMS applet uses in Cinnamon > 2.6 since version 1.3.4.1 released in December 18. Maybe give it another go?

Edit scrap that - the native modal dialog used by BAMS doesn't cut through all full screen apps where zenity does by getting focus.

So the script doesn't pop a zenity window if you reboot, login and go straight into a full screen application and stay on it until the battery gets low enough?
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Locked

Return to “Cinnamon”