home · contact · privacy
Add /list to index available windows.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 7 Aug 2025 02:01:06 +0000 (04:01 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 7 Aug 2025 02:01:06 +0000 (04:01 +0200)
ircplom/client_tui.py
ircplom/tui_base.py

index 9765ac349f235e5a069342632e11748af042a506..f430b468e0556ea6fbe94895c4d089e983d65468 100644 (file)
@@ -24,8 +24,8 @@ class _ClientWindow(Window, ClientQueueMixin):
         super().__init__(**kwargs)
 
     @property
-    def _status_title(self) -> str:
-        return f'{super()._status_title}|{self.client_id}|{self.stream}'
+    def status_title(self) -> str:
+        return f'{super().status_title}|{self.client_id}|{self.stream}'
 
     def _send_msg(self, verb: str, params: tuple[str, ...], **kwargs) -> None:
         self._client_trigger('send', msg=IrcMessage(verb=verb, params=params),
index d5e09873179068431b6713f290b1d6639884b12d..91fb95cb7aec31c422a02f910f3e3c9d511204a3 100644 (file)
@@ -313,7 +313,7 @@ class Window(_Widget):
         return True
 
     @property
-    def _status_title(self) -> str:
+    def status_title(self) -> str:
         'Window title to display in status line.'
         return str(self.idx)
 
@@ -329,7 +329,7 @@ class Window(_Widget):
                 for y, line in enumerate(lines):
                     self._term.write(line, y)
             return False
-        title_box = f'[{self._status_title}]'
+        title_box = f'[{self.status_title}]'
         status_line = title_box + '=' * (self._term.size.x - len(title_box))
         self.log.draw()
         self._term.write(status_line, self._y_status)
@@ -500,6 +500,12 @@ class BaseTui(QueueMixin):
         for item in sorted(to_log):
             self._log.add(f'  /{item}')
 
+    def cmd__list(self) -> None:
+        'List available windows.'
+        self._log.add('windows available via /window:')
+        for win in self._windows:
+            self._log.add(f'  {win.status_title}')
+
     def cmd__quit(self) -> None:
         'Trigger program exit.'
         self._put(QuitEvent())