Cancel firefox fullscreen on low battery

Hey!
I’m looking for any kind of script that would either cancel firefox’s fullscreen or somehow force power management when computer goes low on battery. I’ve gotten myself a bad habit of falling asleep watching Youtube videos / twitch streams and have woken up several times to find my pc with a discharged battery, leading to dataloss :frowning: .
Thinkpad t480, Manjaro kde.

It’s probably easier to set power management options to some reasonably low threshold
below which the machine will be suspended or hibernated or powered down.
That will prevent data loss as it is a controlled shutdown in each case.

Resolved by installing playerctl and adding a terminal command to cancel all playbacks

konsole --noclose -e /bin/bash /path/to/my/script

inside script file goes:

playerctl -a stop
1 Like