[Newm] Add method for displaying active docker containers
This commit is contained in:
		
							parent
							
								
									d855a29b76
								
							
						
					
					
						commit
						af2c327eb7
					
				@ -6,6 +6,9 @@ import time
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
import psutil
 | 
					import psutil
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
 | 
					import docker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker_client = docker.from_env()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from newm.layout import Layout
 | 
					from newm.layout import Layout
 | 
				
			||||||
from newm.helper import BacklightManager, WobRunner, PaCtl
 | 
					from newm.helper import BacklightManager, WobRunner, PaCtl
 | 
				
			||||||
@ -246,6 +249,11 @@ def right_text() -> str:
 | 
				
			|||||||
    return " | ".join([unread_emails(), cpu_usage(), mem_usage(), battery_status()])
 | 
					    return " | ".join([unread_emails(), cpu_usage(), mem_usage(), battery_status()])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def display_docker() -> str:
 | 
				
			||||||
 | 
					    containers = docker_client.containers.list(sparse=True)
 | 
				
			||||||
 | 
					    return f"  {len(containers)}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_time() -> str:
 | 
					def get_time() -> str:
 | 
				
			||||||
    return time.strftime("%a %Y-%m-%d %X")
 | 
					    return time.strftime("%a %Y-%m-%d %X")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user