Skip to content

[extension] Support Platform-Specific Commands Within a Single Extension #843

@medcl

Description

@medcl

Description:
Support defining platform-specific commands within a single extension. This is important because some commands (e.g., sleep, lock, etc.) require different implementations across platforms (macOS, Windows, Linux), but splitting them into separate extensions is not ideal for maintainability and user experience.

Use Case:
A single extension may offer multiple commands. For example, the sleep command differs per platform:
• macOS: pmset sleepnow
• Windows: rundll32.exe powrprof.dll,SetSuspendState 0,1,0
• Linux: systemctl suspend

Rather than creating separate extensions for each platform, it would be better to define all variations in one extension and have Coco automatically choose the appropriate command based on the user’s platform.

Suggested Implementation:
• Add a platform field to the command definition (e.g., ["mac", "windows", "linux"])
• During runtime, Coco filters and registers only the commands relevant to the current OS
• Optionally support fallback behavior if a command is not available for the user’s platform

Benefits:
• Cleaner extension organization
• Easier cross-platform development and maintenance
• Better user experience with a single extension covering multiple platforms

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions