Update m5rshell.py

This commit is contained in:
m5rcel { Marcel }
2025-09-09 17:56:05 +02:00
committed by GitHub
parent c69132b4a0
commit f0722905f6

View File

@@ -54,27 +54,42 @@ class M5RShell(cmd.Cmd):
def _set_idle_presence(self): def _set_idle_presence(self):
if self.rpc_active and self.rpc: if self.rpc_active and self.rpc:
try: try:
self.rpc.update(details="Using the shell", self.rpc.update(
state="Waiting for commands...", details="Using the shell",
small_image="shell", small_text="Shell (Idle)") state="Waiting for commands...",
large_image="m5rcode_logo", # big icon for all RPC updates
large_text="m5rcode Shell",
small_image="shell_icon", # small icon for idle
small_text="Idle"
)
except Exception: except Exception:
self.rpc_active = False self.rpc_active = False
def _set_editing_presence(self, filename): def _set_editing_presence(self, filename):
if self.rpc_active and self.rpc: if self.rpc_active and self.rpc:
try: try:
self.rpc.update(details=f"Editing {filename}", self.rpc.update(
state="In editor", details=f"Editing {filename}",
small_image="shell_editing", small_text="Editing File") state="In editor",
large_image="m5rcode_logo", # big icon stays the same
large_text="m5rcode Shell",
small_image="editing_icon", # small icon changes for editing
small_text="Editing File"
)
except Exception: except Exception:
self.rpc_active = False self.rpc_active = False
def _set_running_presence(self, command_name): def _set_running_presence(self, command_name):
if self.rpc_active and self.rpc: if self.rpc_active and self.rpc:
try: try:
self.rpc.update(details=f"Running {command_name}", self.rpc.update(
state="Executing command", details=f"Running {command_name}",
small_image="shell_running", small_text="Command Running") state="Executing command",
large_image="m5rcode_logo", # big icon stays the same
large_text="m5rcode Shell",
small_image="running_icon", # small icon changes for running
small_text="Command Running"
)
except Exception: except Exception:
self.rpc_active = False self.rpc_active = False