Lid open/close binds
This commit is contained in:
		
					parent
					
						
							
								28933a66d2
							
						
					
				
			
			
				commit
				
					
						3f341d9f5d
					
				
			
		
					 3 changed files with 20 additions and 2 deletions
				
			
		|  | @ -79,8 +79,8 @@ | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   bindl = [ |   bindl = [ | ||||||
|     ",switch:on:Lid Switch,exec,hyprctl keyword monitor LVDS-1, disable" |     ",switch:on:Lid Switch,exec,${/. + ../../misc/scripts/lidclose.sh}" | ||||||
|     ",switch:off:Lid Switch,exec,hyprctl keyword monitor LVDS-1, 1600x900, 0x0, 1" |     ",switch:off:Lid Switch,exec,${/. + ../../misc/scripts/lidopen.sh}" | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   bindm = [ |   bindm = [ | ||||||
|  |  | ||||||
							
								
								
									
										15
									
								
								misc/scripts/lidclose.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								misc/scripts/lidclose.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,15 @@ | ||||||
|  | #!/usr/bin/env bash | ||||||
|  | 
 | ||||||
|  | # Count the number of connected monitors | ||||||
|  | connected_monitors=$(xrandr | grep " connected " | wc -l) | ||||||
|  | # Check if more than one monitor is connected | ||||||
|  | if [ $connected_monitors -gt 1 ]; then | ||||||
|  |     # Disable LVDS-1 | ||||||
|  |     hyprctl keyword monitor LVDS-1, disable | ||||||
|  | else | ||||||
|  |     # Send computer to sleep | ||||||
|  |     swayidle -w \ | ||||||
|  |     timeout 1800 'hyprctl dispatch dpms off' \ | ||||||
|  |     resume 'hyprctl dispatch dpms on' \ | ||||||
|  |     timeout 3600 'systemctl suspend' | ||||||
|  | fi | ||||||
							
								
								
									
										3
									
								
								misc/scripts/lidopen.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								misc/scripts/lidopen.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,3 @@ | ||||||
|  | #!/usr/bin/env bash | ||||||
|  | 
 | ||||||
|  | hyprctl keyword monitor LVDS-1, preferred, auto, 1 | ||||||
		Reference in a new issue
	
	 Frankie B.
				Frankie B.