mirror of
				https://github.com/ohmyzsh/ohmyzsh.git
				synced 2025-11-04 21:31:19 +08:00 
			
		
		
		
	osx: add more arguments to itunes vol command (#7845)
				
					
				
			- Get the iTunes volume without an argument - Shift up / down iTunes volume
This commit is contained in:
		
							parent
							
								
									1343ab67ed
								
							
						
					
					
						commit
						7f66a070a4
					
				@ -236,7 +236,19 @@ function itunes() {
 | 
			
		||||
			opt="$opt track"
 | 
			
		||||
			;;
 | 
			
		||||
		vol)
 | 
			
		||||
			opt="set sound volume to $1" #$1 Due to the shift
 | 
			
		||||
			local new_volume volume=$(osascript -e 'tell application "iTunes" to get sound volume')
 | 
			
		||||
			if [[ $# -eq 0 ]]; then
 | 
			
		||||
				echo "Current volume is ${volume}."
 | 
			
		||||
				return 0
 | 
			
		||||
			fi
 | 
			
		||||
			case $1 in
 | 
			
		||||
				up) new_volume=$((volume + 10 < 100 ? volume + 10 : 100)) ;;
 | 
			
		||||
				down) new_volume=$((volume - 10 > 0 ? volume - 10 : 0)) ;;
 | 
			
		||||
				<0-100>) new_volume=$1 ;;
 | 
			
		||||
				*) echo "'$1' is not valid. Expected <0-100>, up or down."
 | 
			
		||||
				   return 1 ;;
 | 
			
		||||
			esac
 | 
			
		||||
			opt="set sound volume to ${new_volume}"
 | 
			
		||||
			;;
 | 
			
		||||
		playlist)
 | 
			
		||||
		# Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
 | 
			
		||||
@ -299,7 +311,7 @@ EOF
 | 
			
		||||
			echo "\tmute|unmute\tcontrol volume set"
 | 
			
		||||
			echo "\tnext|previous\tplay next or previous track"
 | 
			
		||||
			echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
 | 
			
		||||
			echo "\tvol\tSet the volume, takes an argument from 0 to 100"
 | 
			
		||||
			echo "\tvol [0-100|up|down]\tGet or set the volume. 0 to 100 sets the volume. 'up' / 'down' increases / decreases by 10 points. No argument displays current volume."
 | 
			
		||||
			echo "\tplaying|status\tShow what song is currently playing in iTunes."
 | 
			
		||||
			echo "\tplaylist [playlist name]\t Play specific playlist"
 | 
			
		||||
			echo "\thelp\tshow this message and exit"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user