Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugins): introduce plugin aliases #3157

Merged
merged 11 commits into from
Feb 26, 2024
Merged

feat(plugins): introduce plugin aliases #3157

merged 11 commits into from
Feb 26, 2024

Conversation

imsnif
Copy link
Member

@imsnif imsnif commented Feb 26, 2024

This PR introduces "plugin aliases". These are arbitrary strings that can be assigned to a specific plugin (either a builtin zellij: plugin, a local file: plugin or a remote http(s): plugin).

Whenever Zellij encounters such an alias (be it when launching a plugin from the CLI, with a pipe, in a layout, or when launching a plugin through another plugin) it will replace the alias with the correct plugin if it knows it. Aliases can also optionally include plugin configuration.

These aliases can be defined in the Zellij configuration under the existing plugins block which has been repurposed for this case:

plugins {
    tab-bar location="zellij:tab-bar"
    status-bar location="zellij:status-bar"
    strider location="zellij:strider"
    compact-bar location="zellij:compact-bar"
    session-manager location="zellij:session-manager"
    welcome-screen location="zellij:session-manager" {
        welcome_screen true
    }
    filepicker location="zellij:strider"
}

The old configuration block items will be ignored.

Since the built-in layouts now use these aliases (eg. the default layout now uses status-bar instead of zellij:status-bar), this can be a much easier way to integrate plugins. For example:

plugins {
    compact-bar location="https://github.com/dj95/zjstatus/releases/download/v0.13.0/zjstatus.wasm" {
        format_left   "{mode} #[fg=#89B4FA,bold]{session}"
        format_center "{tabs}"
        // ...
    }
}

This will cause zjstatus to be loaded instead of the compact-bar whenever the compact layout is used, without the need to define a custom layout and swap layouts.

These will also be especially useful as a generic interface when developing plugins and referring to well-known conventions. For example, using the filepicker alias in order to get the user to choose a file using whichever filepicker plugin they have defined, without the initiating plugin having to know the specifics about said filepicker plugin.

P.S.
This PR also removes the filesystem watching from strider, which was left there by accident. It should solve most bugs about strider not starting properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant