#!/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 -f -C ~/.config/swaylock/config --grace 0 && sleep 0.1