From a2b2ff94414187b8d65109bf50b2dd7bbc02a01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Mon, 30 Dec 2024 18:51:01 +0100 Subject: [PATCH] audio-control: remove references to CACHE_DIR No longer used. --- audio-control | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/audio-control b/audio-control index d3fd895..dbc9107 100755 --- a/audio-control +++ b/audio-control @@ -1,5 +1,4 @@ #!/bin/bash -CACHE_DIR="$HOME/.cache/audio-control" if [ "$#" -eq 0 ] then @@ -12,38 +11,23 @@ then exit 1 fi -if ! [ -d $CACHE_DIR ] -then - mkdir -p $CACHE_DIR -fi - -query_outport() { - active_port="$(pactl list sinks | grep 'Active Port')" - if [[ $active_port == *"speaker"* ]] - then - echo "SPK" > $CACHE_DIR/port - else - echo "HDF" > $CACHE_DIR/port - fi - pactl list sinks | awk '/Mute/ { if ($2 == "no") print "VOL"; else print "MUT"; }' > $CACHE_DIR/vol_status - pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' > $CACHE_DIR/vol_level -} - case $1 in "mute") pactl set-sink-mute 0 toggle - pactl list sinks | awk '/Mute/ { if ($2 == "no") print "VOL"; else print "MUT"; }' > $CACHE_DIR/vol_status;; + pactl list sinks | awk '/Mute/ { if ($2 == "no") print "VOL"; else print "MUT"; }' + ;; "vol-up") pactl set-sink-volume 0 +5% - pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' > $CACHE_DIR/vol_level;; + pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' + ;; "vol-down") pactl set-sink-volume 0 -5% - pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' > $CACHE_DIR/vol_level;; + pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' + ;; "reset") pactl set-sink-volume 0 50% - pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' > $CACHE_DIR/vol_level;; - "toggle-port") - query_outport;; + pactl list sinks | grep '^[[:space:]]Volume:' | head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,' + ;; "help") echo "USAGE: audio-control