2020-04-29 12:42:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Inhibit screen locker when media players are running
|
|
|
|
# Cheap method, add missing players to regex
|
|
|
|
isrunning=1
|
|
|
|
player=`ps -u $USER | grep -Ec "(rhythmbox|totem|mpv|vlc|*mplayer)"`
|
|
|
|
|
|
|
|
if [ "$player" -ge "$isrunning" ]; then
|
|
|
|
if [ "$1" == "-t" ]; then
|
|
|
|
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
|
|
|
|
else
|
|
|
|
if [ "$1" != "-f" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
revert() {
|
|
|
|
swaymsg "output * dpms on"
|
|
|
|
rm -Rf $HOME/.tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
wdir=$HOME/.tmp/lckr
|
|
|
|
screen1=$wdir/l1.png
|
|
|
|
icon=/usr/share/pixmaps/fedora-logo-sprite.png # with style
|
|
|
|
lwaucj=$wdir/nuvdsp.png
|
|
|
|
mkdir -p $wdir && chmod 1700 $wdir
|
|
|
|
|
2020-05-29 13:24:33 +02:00
|
|
|
grim -o eDP-1 $screen1 # take a screenshot
|
2020-04-29 12:42:07 +02:00
|
|
|
|
|
|
|
convert $screen1 -scale 10% -scale 1000% $screen1
|
|
|
|
convert $screen1 $icon -gravity center -composite -matte $lwaucj && rm $screen1
|
|
|
|
|
|
|
|
# Lock screen using swaylock showing number of failed attempts, not forking,
|
|
|
|
# ignoring empty password (possibly without unlock indicator (-u))
|
|
|
|
swaylock -f -n -e -i "$lwaucj" || swaylock -f -e -n -c 141414 # just dark-grey
|
|
|
|
trap revert exit
|
|
|
|
# EXIT HUP INT TERM - 0 1 3 15
|
|
|
|
|
|
|
|
revert
|