2017-09-20 17:23:24 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
icon="$HOME/.config/i3/icons/lock.png"
|
|
|
|
tmpbg='/tmp/screen.png'
|
|
|
|
|
2019-11-11 10:25:48 +01:00
|
|
|
# detect whether tidal is running
|
2022-08-03 21:28:16 +02:00
|
|
|
isPlaying=$(~/.config/i3/scripts/tidal-cli.sh status)
|
2019-02-20 12:51:49 +01:00
|
|
|
|
2017-09-20 17:23:24 +02:00
|
|
|
scrot "$tmpbg"
|
|
|
|
convert "$tmpbg" -scale 10% -scale 1000% "$tmpbg"
|
|
|
|
convert "$tmpbg" "$icon" -gravity center -composite -matte "$tmpbg"
|
2019-02-20 12:51:49 +01:00
|
|
|
|
|
|
|
# Stop music if playing
|
2019-11-11 10:20:20 +01:00
|
|
|
~/.config/i3/scripts/tidal-cli.sh pause
|
2019-02-20 12:51:49 +01:00
|
|
|
|
2019-02-22 09:15:10 +01:00
|
|
|
# check whether the lockscreen is being activated because of a suspend
|
|
|
|
if [[ $* == *--suspend ]]; then
|
2022-08-03 21:28:16 +02:00
|
|
|
# if it is, simply lock without no-fork
|
|
|
|
i3lock -f -i "$tmpbg"
|
2019-02-22 09:15:10 +01:00
|
|
|
else
|
2022-08-03 21:28:16 +02:00
|
|
|
# if it isn't suspended, enable no-fork
|
|
|
|
i3lock -n -f -i "$tmpbg"
|
2019-02-20 12:51:49 +01:00
|
|
|
|
2022-08-03 21:28:16 +02:00
|
|
|
# if tidal was playing before we locked, resume.
|
|
|
|
if [ $isPlaying == "playing" ]; then
|
|
|
|
~/.config/i3/scripts/tidal-cli.sh play
|
|
|
|
fi
|
|
|
|
rm -rf $tmpbg
|
2019-11-11 10:20:20 +01:00
|
|
|
fi
|