Use LVDS for laptop or first connected output
This commit is contained in:
		
							parent
							
								
									45613fb4a7
								
							
						
					
					
						commit
						7337e99c26
					
				
							
								
								
									
										22
									
								
								ecran
								
								
								
								
							
							
						
						
									
										22
									
								
								ecran
								
								
								
								
							|  | @ -59,6 +59,28 @@ get_primary_output_name() {                                     # {{{ | |||
| 	if [ -n "${local_primary_output_name}" ]; then | ||||
| 		debug_message "get_primary_output_name − \ | ||||
| An output is defined as primary: ${local_primary_output_name}". | ||||
| 
 | ||||
| 	else | ||||
| 		## Then check if an output starting with "LVD" (typically a laptop) is connected | ||||
| 		local_primary_output_name=$(xrandr | grep "^LVD" | grep " connected" | awk 'NR==1{ print $1 }') | ||||
| 		if [ -n "${local_primary_output_name}" ]; then | ||||
| 			debug_message "get_primary_output_name − \ | ||||
| The primary output seems to be a laptop screen: ${local_primary_output_name}". | ||||
| 
 | ||||
| 		else | ||||
| 			## Then check if any output is connected and take the first one | ||||
| 			local_primary_output_name=$(xrandr | grep " connected" | awk 'NR==1{ print $1 }') | ||||
| 			if [ -n "${local_primary_output_name}" ]; then | ||||
| 				debug_message "get_primary_output_name − \ | ||||
| Take the first connected output as primary: ${local_primary_output_name}". | ||||
| 
 | ||||
| 			else | ||||
| 				debug_message "get_primary_output_name − \ | ||||
| Unable to get primary output name! | ||||
| Ensure to have a primary, LVDS or any connected output in xrandr." | ||||
| 				exit 2 | ||||
| 			fi | ||||
| 		fi | ||||
| 	fi | ||||
| 
 | ||||
| 	readonly MAIN_OUTPUT_NAME="${local_primary_output_name}" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue