dotfiles

My PC Dotfiles & Website

scripts/audio.sh (557B)


 1#! /usr/bin/env nix
 2#! nix shell nixpkgs#bash nixpkgs#glib nixpkgs#playerctl -c bash
 3
 4# Audio Tweaks #
 5
 6# Pause playback on Screen Lock
 7gdbus monitor -y -d org.freedesktop.login1 | grep LockedHint --line-buffered |
 8  while read -r line
 9  do
10    case "$line" in
11      *"<true>"*)
12        if playerctl status | grep Playing
13        then
14          PLAY=true
15        else
16          PLAY=false
17        fi
18        playerctl pause -a
19      ;;
20      *"<false>"*)
21        if $PLAY
22        then
23          playerctl play-pause
24        fi
25      ;;
26    esac
27  done
28exit