wayfire icon indicating copy to clipboard operation
wayfire copied to clipboard

Add custom signals to Wayfire's IPC events

Open killown opened this issue 1 year ago • 0 comments

Hello,

Could you enable a way to add custom signals to Wayfire's IPC events? I am working on a Wayfire plugin and need to handle additional IPC events.

The goal is to inject custom signals within the IPC events

Why Custom Data?

1. Enhanced Scripting and Automation

Reason: Users often rely on scripting to automate workflows or integrate Wayfire with external tools. Custom data in IPC responses provides additional context for scripts to make informed decisions.
Advantages:

  • Scripts can access richer data, enabling more sophisticated automation.
  • Example: A script monitoring active windows could use custom data to identify application-specific behaviors (e.g., whether a window belongs to a media player or a browser).

2. Improved Debugging and Monitoring

Reason: Debugging complex compositor behavior or diagnosing issues often requires detailed insights into the system's state.
Advantages:

  • Developers and users can inject diagnostic information into IPC responses for easier debugging.
  • Example: Injecting performance metrics (e.g., frame rendering times, GPU usage) or logging specific events (e.g., focus changes, window movements).

3. Custom Metadata for Applications

Reason: Applications or external tools interacting with Wayfire may need additional metadata about views or workspaces that are not part of the default IPC schema.
Advantages:

  • Applications can store and retrieve custom metadata associated with views, outputs, or workspaces.
  • Example: A taskbar application could use custom data to display app-specific icons or badges based on injected metadata.

Example Use Case

For example, a script monitoring CPU usage for each view could detect spikes and set custom data like {"cpu-spikes": "True"} if the view's process usage ever exceeds N%.

some random examples:

: {
    "id": 631,
    "pid": 66116,
    "title": "Crunchyroll",
    "app-id": "msedge-www.crunchyroll.com__-Default",
    "base-geometry": {
        "x": 0,
        "y": 39,
        "width": 1920,
        "height": 1041
    },
    "custom_data": {
        "is_playing_audio": true
    }
}

{
    "id": 631,
    "pid": 66116,
    "title": "Crunchyroll",
    "custom_data": {
        "tags": ["entertainment", "anime", "streaming"]
    }
}

{
    "id": 631,
    "pid": 66116,
    "title": "Crunchyroll",
    "custom_data": {
        "gpu_usage": "30%",
        "cpu_usage": "15%"
    }
}

{
     "custom_data": {
        "username": "Ammen",
        "start_time": "2023-10-15T10:00:00Z",
        "idle_time_seconds": 1234
    }
}

{
    "id": 631,
    "pid": 66116,
    "title": "Assista na Crunchyroll",
    "custom_data": {
        "window_rules_detected": {
            "always_on_top": true,
        }
    }
}

There is just too many possibilities and use cases for this enhancement!

Thank you for considering this request!

killown avatar Aug 20 '24 16:08 killown