MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / set_title

Method set_title

core/sysmon.py:102–119  ·  view source on GitHub ↗

Write a compact stats string to the terminal title bar.

(self)

Source from the content-addressed store, hash-verified

100 return line
101
102 def set_title(self) -> None:
103 """Write a compact stats string to the terminal title bar."""
104 if not sys.stdout.isatty():
105 return
106 s = self.snapshot
107 cpu = s["cpu"]
108 ru = s["ram_used"] / 1024 ** 3
109 rt = s["ram_total"] / 1024 ** 3
110 temp = s["temp"]
111 parts = [f"CPU {cpu:.0f}%", f"RAM {ru:.1f}/{rt:.1f}G"]
112 if temp is not None:
113 parts.append(f"T {temp:.0f}°C")
114 bar = " · ".join(parts)
115 try:
116 sys.stdout.write(f"\033]0;Codey {bar}\007")
117 sys.stdout.flush()
118 except Exception:
119 pass
120
121 # ── internals ─────────────────────────────────────────────────────────────
122

Callers 1

_loop_onceMethod · 0.95

Calls 3

appendMethod · 0.80
flushMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected