fixing volume(1): separating out the system-dependent portions
This commit is contained in:
		
							parent
							
								
									a998eb9ef7
								
							
						
					
					
						commit
						01fee33d0f
					
				
							
								
								
									
										18
									
								
								bin/volume.netbsd
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										18
									
								
								bin/volume.netbsd
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
#!/bin/sh -e
 | 
			
		||||
 | 
			
		||||
# NetBSD 9.2 STABLE 2021-07
 | 
			
		||||
 | 
			
		||||
case "$1" in
 | 
			
		||||
a*)
 | 
			
		||||
	audioctl -w play.gain=$2 >/dev/null
 | 
			
		||||
	exit $?
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
s*)	# hacky
 | 
			
		||||
	audioctl -a \
 | 
			
		||||
		| grep "play\.gain" \
 | 
			
		||||
		| cut -d '=' -f 2
 | 
			
		||||
	exit $?
 | 
			
		||||
	;;
 | 
			
		||||
esac
 | 
			
		||||
exit 1
 | 
			
		||||
							
								
								
									
										20
									
								
								bin/volume.pulseaudio
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								bin/volume.pulseaudio
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
#!/bin/sh -e
 | 
			
		||||
 | 
			
		||||
# pactl 15.0 compiled+linked with libpulse 15.0.0
 | 
			
		||||
 | 
			
		||||
case "$argv1" in
 | 
			
		||||
a*)
 | 
			
		||||
	pactl set-sink-volume @DEFAULT_SINK@ $2%
 | 
			
		||||
	exit $?
 | 
			
		||||
	;;
 | 
			
		||||
 | 
			
		||||
s*)	# really hacky, gets the job done
 | 
			
		||||
	# gets the volume % of Lchan specifically
 | 
			
		||||
	pactl get-sink-volume @DEFAULT_SINK@ \
 | 
			
		||||
		| sed q \
 | 
			
		||||
		| cut -d '/' -f 2 \
 | 
			
		||||
		| xargs echo \
 | 
			
		||||
		| sed s/'%'//
 | 
			
		||||
	;;
 | 
			
		||||
esac
 | 
			
		||||
exit 1
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user