Add prof.get_current_window API to Retrieve Current Window Title #34

Closed
opened 2025-10-01 05:57:40 +00:00 by jabber.developer · 1 comment

Updated Issue

Description
Currently, the CProof's Python API provides functions like prof.get_current_recipient and prof.get_current_muc to retrieve context-specific information about the active chat. However, there is no way to retrieve the title of the currently active window, which is useful for plugins that need to display or act on the window's titlebar content (e.g., for UI customization or context-aware commands).

This is particularly crucial for plugin windows, where the title matches the window tag used for communication (e.g., in prof_win_show and similar API functions). Plugins rely on tags to target specific windows for operations like displaying messages. Retrieving the current window title allows plugins to dynamically obtain the tag if the active window is a plugin window, enabling seamless interaction without hardcoding tags.

Proposed Solution

  • Add prof.get_current_window() to the API that returns the title of the current window as a string, matching the titlebar display
  • Optionally, extend api_win_show (and similar functions) to support additional window types, such as falling back to cons_show for console or non-plugin windows if the tag doesn't match a plugin window.

This would align with existing context-retrieval functions and enhance plugin functionality.

Use Case

  • A plugin could use prof.get_current_window to get the title (tag for plugin windows) and then call prof.win_show(title, "Message") to display content in the active plugin window.
  • For non-plugin windows, an extended api_win_show could route to appropriate display functions (e.g., cons_show for console).

Acceptance Criteria:

  • Add prof.get_current_window() -> str to the Python API.
  • Add char* get_current_window() to the C API.
  • Ensure it returns the window title as shown in the titlebar, serving as the tag for plugin windows.
  • Update API documentation with function description, example, and note on plugin window tags.
  • Consider PR for extending api_win_show to handle non-plugin windows (e.g., via fallback to cons_show).
### Updated Issue **Description** Currently, the CProof's Python API provides functions like `prof.get_current_recipient` and `prof.get_current_muc` to retrieve context-specific information about the active chat. However, there is no way to retrieve the title of the currently active window, which is useful for plugins that need to display or act on the window's titlebar content (e.g., for UI customization or context-aware commands). This is particularly crucial for plugin windows, where the title matches the window tag used for communication (e.g., in `prof_win_show` and similar API functions). Plugins rely on tags to target specific windows for operations like displaying messages. Retrieving the current window title allows plugins to dynamically obtain the tag if the active window is a plugin window, enabling seamless interaction without hardcoding tags. **Proposed Solution** - Add `prof.get_current_window()` to the API that returns the title of the current window as a string, matching the titlebar display - Optionally, extend `api_win_show` (and similar functions) to support additional window types, such as falling back to `cons_show` for console or non-plugin windows if the tag doesn't match a plugin window. This would align with existing context-retrieval functions and enhance plugin functionality. **Use Case** - A plugin could use `prof.get_current_window` to get the title (tag for plugin windows) and then call `prof.win_show(title, "Message")` to display content in the active plugin window. - For non-plugin windows, an extended `api_win_show` could route to appropriate display functions (e.g., `cons_show` for console). **Acceptance Criteria**: - Add `prof.get_current_window() -> str` to the Python API. - Add `char* get_current_window()` to the C API. - Ensure it returns the window title as shown in the titlebar, serving as the tag for plugin windows. - Update API documentation with function description, example, and note on plugin window tags. - Consider PR for extending `api_win_show` to handle non-plugin windows (e.g., via fallback to `cons_show`).
jabber.developer added the
Kind/Enhancement
Reviewed
Confirmed
1
Priority
Medium
3
labels 2025-10-01 05:57:40 +00:00
jabber.developer self-assigned this 2025-10-01 05:57:40 +00:00
Author
Owner

Closed by #35

Closed by #35
jabber.developer added this to the Plans (2025-2026) project 2026-04-25 18:11:34 +00:00
jabber.developer moved this to Done in Plans (2025-2026) on 2026-04-25 18:11:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devs/cproof#34
No description provided.