feat(api): add get_current_window call

Add prof_get_current_window API to retrieve the title of the currently active window, matching the titlebar display.

The feature is especially useful to track currently used plugin window.
This commit is contained in:
2025-09-30 16:40:02 +02:00
parent 3738be4af1
commit 266f5aa046
8 changed files with 112 additions and 57 deletions

View File

@@ -830,6 +830,22 @@ def get_current_recipient() -> str | None:
"""
pass
def get_current_window() -> str:
"""Retrieves the title of the current window as shown in the titlebar.
Returns the title of the currently active window, matching the titlebar display.
Special cases:
- For MUC configuration windows, includes "config" and an asterisk if modified (e.g., "room@example.com config \*").
- For vCard windows, includes the bare JID and an asterisk if modified (e.g., "vCard user@example.com \*").
:return: The window title as a string.
Example::
title = prof.get_current_window()
prof.cons_show(f"Current window: {title}")
"""
def get_current_muc() -> str | None:
"""Retrieves the Jabber ID of the current chat room.