mirror of
				https://github.com/tiyn/dotfiles.git
				synced 2025-10-31 04:21:15 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			644 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			644 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| # toggle external monitor
 | |
| # by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
 | |
| 
 | |
| intern=${INTERNAL_MONITOR:-LVDS1}
 | |
| extern=${EXTERNAL_MONITOR:-HDMI2}
 | |
| 
 | |
| case "$1" in
 | |
|   toggle) (xrandr | grep "$extern disconnected")
 | |
|     (xrandr --listactivemonitors | grep $extern) || ((xrandr --output $extern --right-of $intern --auto && wallpaper desktop) & exit)
 | |
|     (xrandr --listactivemonitors | grep $extern) && xrandr --output $extern --off
 | |
|     wallpaper desktop
 | |
|     ;;
 | |
|   *) cat << EOF
 | |
| monitor: cli script to enable and disable monitors.
 | |
| 
 | |
| Allowed options:
 | |
|   toggle	Toggle the set monitor on and off
 | |
|   all else	Print this message
 | |
| 
 | |
| EOF
 | |
| esac
 |