dotfiles/bin/sway-locker

15 lines
484 B
Plaintext
Raw Normal View History

#!/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
2023-07-10 04:18:04 +02:00
if [ "$1" == "-t" ] || [ "$1" == "-f" ]; then
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
fi
fi
2023-07-10 04:18:04 +02:00
swaylock -f -C ~/.config/swaylock/config --grace 0 && sleep 0.1