dotfiles/bin/sway-locker

15 lines
457 B
Bash
Executable File

#!/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" || "$1" == "-f" ]; then
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
fi
fi
swaylock -C ~/.config/swaylock/config -f