[Newm] Add method for displaying active docker containers

This commit is contained in:
Lucien Cartier-Tilet 2022-11-23 17:54:34 +01:00
parent d855a29b76
commit af2c327eb7
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,9 @@ import time
import logging
import psutil
import subprocess
import docker
docker_client = docker.from_env()
from newm.layout import Layout
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()])
def display_docker() -> str:
containers = docker_client.containers.list(sparse=True)
return f"{len(containers)}"
def get_time() -> str:
return time.strftime("%a %Y-%m-%d %X")