Il 03/01/2024 23:52, Valerio Vanni ha scritto:
Il 03/01/2024 17:18, Franco Martelli ha scritto:
On 02/01/24 at 19:15, Valerio Vanni wrote:
This way, I don't have to remember to close kaffeine before suspend.
If you have Kaffeine always running on your system you can try this
script:
I had an idea to do a relaunch, but it's not always running.
Now I've done this, to relaunch only if it was running:
----------------------
#!/bin/bash
case "$1" in
pre)
#code execution BEFORE sleeping/hibernating/suspending
kaffeine_killed=$(/usr/bin/killall kaffeine 2>&1)
echo $kaffeine_killed > /temp/kafstate.txt
/usr/bin/sleep 2
/usr/sbin/rmmod cx23885
;;
post)
#code execution AFTER resuming
/usr/sbin/modprobe cx23885
/usr/bin/sleep 3
kaffeine_killed=$(cat /temp/kafstate.txt)
if [[ $kaffeine_killed == "" ]]; then
/usr/bin/su valerio -c 'XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0 XDG_CURRENT_DESKTOP=KDE /usr/bin/kaffeine --lastchannel
>/dev/null 2>&1 &'
fi
rm -f /temp/kafstate.txt
;;
esac
----------------------