1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-03-19 18:17:45 +01:00

102 lines
3.1 KiB
Plaintext
Raw Normal View History

2019-09-13 10:51:43 +02:00
#!/bin/sh
2020-04-02 00:06:34 +02:00
2019-09-13 10:51:43 +02:00
# A general audio interface for LARBS.
# Based on a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
2024-03-17 22:52:40 +01:00
# Heavily extended and updated to a pipewire system
2019-09-13 10:51:43 +02:00
device=${LOOPBACK_DEVICE:-Easy Effects Source}
name=$(wpctl status | sed -n '/Sources/,$p' | sed -n '/Filter/q;p' | grep "$device" | sed -e "s/*/\ /g")
id=$( echo $name | cut -d '.' -f 1 | cut -c 5-)
node=$(wpctl inspect $id | grep node.name | cut -d '=' -f 2)
[ -z "$2" ] && num="5" || num="$2"
2019-09-13 10:51:43 +02:00
case "$1" in
2024-03-17 22:52:40 +01:00
up) wpctl set-volume @DEFAULT_AUDIO_SINK@ "$num"%+
pkill -RTMIN+4 $STATUSBAR ;;
down) wpctl set-volume @DEFAULT_AUDIO_SINK@ "$num"%-
pkill -RTMIN+4 $STATUSBAR ;;
deaf) wpctl set-mute @DEFAULT_SINK@ 1
pkill -RTMIN+4 $STATUSBAR ;;
undeaf) wpctl set-mute @DEFAULT_SINK@ 0
pkill -RTMIN+4 $STATUSBAR ;;
mute) wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 1
pkill -RTMIN+4 $STATUSBAR ;;
unmute) wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0
pkill -RTMIN+4 $STATUSBAR ;;
deaf_toggle)
if amixer get Master | tail -2 | grep -q '\[on\]'; then
notify-send -u low 'sxhkd' 'Sound muted\nMicrophone muted'
lmc mute
lmc deaf
else
lmc mute
lmc undeaf
paplay ~/.local/bin/etc/sxhkd/audio/sound_resumed.wav
fi ;;
mute_toggle)
2024-10-12 18:06:14 +02:00
echo $(amixer get Capture)
2024-03-17 22:52:40 +01:00
if amixer get Capture | tail -2 | grep -q '\[on\]'; then
lmc mute
lmc undeaf
paplay ~/.local/bin/etc/sxhkd/audio/mic_muted.wav
else
lmc unmute
lmc undeaf
paplay ~/.local/bin/etc/sxhkd/audio/mic_activated.wav
fi ;;
previous) playerctl previous
sleep 1
pkill -RTMIN+9 $STATUSBAR ;;
playpause) playerctl play-pause
sleep 1
pkill -RTMIN+9 $STATUSBAR ;;
next) playerctl next
sleep 1
pkill -RTMIN+9 $STATUSBAR ;;
shuffle) playerctl shuffle toggle
sleep 1
pkill -RTMIN+9 $STATUSBAR ;;
loop) playerctl loop none
sleep 1
pkill -RTMIN+9 $STATUSBAR ;;
tap) wpctl set-volume $id 1.0
touch ~/.local/state/loopback.lock
pw-loopback -C $node &
notify-send -u low 'sxhkd' "Started loopback of $device" ;;
untap) killall pw-loopback
rm ~/.local/state/loopback.lock
notify-send -u low 'sxhkd' "Stopped all loopbacks" ;;
tap_toggle)
if [ -f ~/.local/state/loopback.lock ]; then
lmc untap
else
lmc tap
fi ;;
2024-03-17 22:52:40 +01:00
*) cat << EOF
2019-10-04 01:15:05 +02:00
lmc: cli music interface for pulse for those with divine intellect too
grand to remember the pamixer commands.
2019-09-13 10:51:43 +02:00
Allowed options:
up NUM Increase volume (5% default)
down NUM Decrease volume (5% default)
2024-03-17 22:52:40 +01:00
mute Mute microphone
unmute Unmute microphone
2024-05-18 05:14:10 +02:00
mute_toggle Toggle between mute and unmute
2024-03-17 22:52:40 +01:00
deaf Deaf sound
undeaf Undeaf sound
deaf_toggle Toggle between deaf and undeaf
2024-03-17 22:52:40 +01:00
playpause Toggle play or pause in player
2024-05-18 05:14:10 +02:00
previous Play previous song in player
2024-03-17 22:52:40 +01:00
next Play next song in player
shuffle Toggle the shuffle mode
loop Toggle the loop mode
tap Start loopback for source device
untap Stop all active source loopbacks
tap_toggle Start or stop loopback depending if it is already running
2019-09-13 10:51:43 +02:00
all else Print this message
EOF
esac