-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathspeakers
More file actions
executable file
·44 lines (38 loc) · 973 Bytes
/
speakers
File metadata and controls
executable file
·44 lines (38 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
CARD="alsa_card.pci-0000_00_1f.3"
SINK="alsa_output.pci-0000_00_1f.3.analog-stereo"
PROFILE_ON="output:analog-stereo"
PROFILE_OFF="off"
usage() {
echo "Usage: $0 [enable|disable|status]"
exit 1
}
case "$1" in
enable)
echo "Enabling laptop speakers..."
pactl set-card-profile "$CARD" "$PROFILE_ON"
pactl set-default-sink "$SINK"
echo "Speakers enabled and set as default sink."
kill -44 $(pidof dwmblocks)
;;
disable)
echo "Disabling laptop speakers..."
pactl set-card-profile "$CARD" "$PROFILE_OFF"
echo "Speakers disabled and hidden from pavucontrol."
kill -44 $(pidof dwmblocks)
;;
status)
pactl list cards | awk -v card="$CARD" '
$0 ~ "Card #" { current_card = "" }
$0 ~ "Name: " {
if ($2 == card) current_card = card
}
current_card && /Active Profile:/ {
print "Active Profile for", card, ":", $3
exit
}'
;;
*)
usage
;;
esac