Makes the screen layouts scripts slightly more robust
I should probably re-work all of them at some point but these changes allow for external monitors with a resolution other than 1920x1080. When switching to laptop only, I disable all other monitors by listing all rather than hard coding common ones
This commit is contained in:
		
							parent
							
								
									081c3bfeb4
								
							
						
					
					
						commit
						cc94b994b5
					
				
					 3 changed files with 8 additions and 3 deletions
				
			
		|  | @ -3,9 +3,10 @@ | ||||||
| laptopScreen="eDP-1" | laptopScreen="eDP-1" | ||||||
| externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | | externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | | ||||||
| 	cut -d ' ' -f 1)" | 	cut -d ' ' -f 1)" | ||||||
|  | externalResolution="$(xrandr | grep -A 1 "$externalScreen" | sed -n 2p | awk '{print $1}')" | ||||||
| 
 | 
 | ||||||
| pkill compton | pkill compton | ||||||
| xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output "$externalScreen" --mode 1920x1080 --pos 1920x0 --rotate normal | xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos 1920x0 --rotate normal | ||||||
| /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown | /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown | ||||||
| 
 | 
 | ||||||
| # xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal | # xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal | ||||||
|  |  | ||||||
|  | @ -3,7 +3,8 @@ | ||||||
| laptopScreen="eDP-1" | laptopScreen="eDP-1" | ||||||
| externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | | externalScreen="$(xrandr | grep -Eo '^.* connected' | grep -v "$laptopScreen" | | ||||||
| 	cut -d ' ' -f 1)" | 	cut -d ' ' -f 1)" | ||||||
|  | externalResolution="$(xrandr | grep -A 1 "$externalScreen" | sed -n 2p | awk '{print $1}')" | ||||||
| 
 | 
 | ||||||
| pkill compton | pkill compton | ||||||
| xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output "$externalScreen" --mode 1920x1080 --pos 0x0 --rotate normal | xrandr --output "$laptopScreen" --primary --mode 1920x1080 --pos "${externalResolution%x*}x0" --rotate normal --output "$externalScreen" --mode "$externalResolution" --pos 0x0 --rotate normal | ||||||
| /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown | /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown | ||||||
|  |  | ||||||
|  | @ -1,2 +1,5 @@ | ||||||
| #!/bin/sh | #!/bin/sh | ||||||
| xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off | pkill compton | ||||||
|  | xrandr | sed '/^ /d' | grep -Ev '(:|eDP-1)' | awk -v ORS=" " '{print "--output " $1 " --off"}' | | ||||||
|  | 	xargs xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal | ||||||
|  | /usr/bin/compton --config "$HOME/.config/picom/picom.conf" & disown | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue