2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/bin/bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-31 10:59:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set -euo pipefail
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:48:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if [ "$#" -eq 0 ]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									echo "Requires a command. Run with 'help' for a list of commands."
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									exit 1
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:48:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if [ "$#" -gt 1 ]
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									echo "Too many arguments. Run with 'help' for a list of commands."
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									exit 1
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:48:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fi
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								case $1 in
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"mute")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										pactl set-sink-mute 0 toggle
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:51:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										;;
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"vol-up")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										pactl set-sink-volume 0 +5%
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:51:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										;;
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"vol-down")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										pactl set-sink-volume 0 -5%
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:51:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										;;
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"reset")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										pactl set-sink-volume 0 50%
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-30 18:51:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										;;
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"help")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										echo "USAGE: audio-control <command>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Commands:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									mute          toggle mute
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vol-up        raise the volume
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									vol-down      lower the volume
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									reset         reset volume (to round number)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									toggle-port   toggle the output port
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-31 10:58:59 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									help          show this help information"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										;;
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-31 08:25:02 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									*)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										echo "Invalid command. Run with 'help' for a list of commands."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										exit 1;;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								esac
							 |