This commit is contained in:
Thomas Forgione 2025-05-02 16:24:18 +02:00
parent 755a5ac611
commit 8968a136d3

View File

@ -11,11 +11,16 @@ bars = "_▂▃▄▅▆▇█"
batteries = "󰂎󰁺󰁻󰁼󰁽󰁾󰁿󰂀󰂁󰂁󰁹"
batteries_charging = "󰢟󰢜󰂆󰂇󰂈󰢝󰂉󰢞󰂊󰂋󰂅"
class Monitor:
"""
A monitor on which many workspaces can appear.
"""
def __init__(self, id: int, name: str):
"""
Constructs a monitor from its id and its name.
"""
self.id = id
self.name = name
@ -84,7 +89,11 @@ class Workspace:
Workspaces with id from 10 * n + k belongs to the same monitor for k in [1, 10].
"""
def __init__(self, id: int):
"""
Constructs a workspace from its id.
"""
self.id = id
@staticmethod
@ -141,15 +150,16 @@ def to_bar(x):
def monitor_stats():
try:
import psutil
except:
print('Stats requires psutil (run `pip install psutil`)', file=sys.stderr)
sys.exit(1)
"""
Monitors CPU and MEM usage and prints info in file.
"""
try:
import psutil
except ModuleNotFoundError:
print('Stats requires psutil (run `pip install psutil`)', file=sys.stderr)
sys.exit(1)
cpu_values = [0] * 10
mem_values = [0] * 10