feat(api): add get_current_window call
All checks were successful
CI API Docs / Test C API Documentation Generation (pull_request) Successful in 25s
CI API Docs / Test Python API Documentation Generation (pull_request) Successful in 31s
CI Code / Check coding style (pull_request) Successful in 35s
CI Code / Check spelling (pull_request) Successful in 20s
CI Code / Linux (arch) (pull_request) Successful in 13m58s
CI Code / Linux (ubuntu) (pull_request) Successful in 13m41s
CI Code / Linux (debian) (pull_request) Successful in 16m19s

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 40dd773c6a
commit e36f7d5964
8 changed files with 107 additions and 52 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.