mirror of
				https://github.com/ItsDrike/dotfiles.git
				synced 2025-10-31 16:06:36 +00:00 
			
		
		
		
	Handle hyprctl returning invalid json
This commit is contained in:
		
							parent
							
								
									745e6838ec
								
							
						
					
					
						commit
						d918406072
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		|  | @ -106,7 +106,15 @@ def get_workspaces() -> list[OutputWorkspaceInfo]: | |||
|     """Obtain workspaces from hyprctl, sort them and add format_name arg.""" | ||||
|     proc = subprocess.run(["hyprctl", "workspaces", "-j"], stdout=subprocess.PIPE) | ||||
|     proc.check_returncode() | ||||
|     workspaces: list[WorkspaceInfo] = json.loads(proc.stdout) | ||||
|     try: | ||||
|         workspaces: list[WorkspaceInfo] = json.loads(proc.stdout) | ||||
|     except json.JSONDecodeError: | ||||
|         sys.stderr.writelines([ | ||||
|             "Error decoding json response from hyprctl, returning empty workspaces", | ||||
|             f"Actual captured output from hyprctl: {proc.stdout!r}" | ||||
|         ]) | ||||
|         sys.stderr.flush() | ||||
|         workspaces = [] | ||||
| 
 | ||||
|     proc = subprocess.run(["hyprctl", "monitors", "-j"], stdout=subprocess.PIPE) | ||||
|     proc.check_returncode() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue