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

Plugin API: open_terminal() panes have 'wrong' title and run as command panes #3875

Open
msirringhaus opened this issue Dec 16, 2024 · 0 comments
Assignees

Comments

@msirringhaus
Copy link
Contributor

Issue description

When calling open_terminal() from a plugin, the newly created terminal behaves differently than one created via e.g. Alt+n

  1. The title of the pane is not e.g. Pane #2, but /bin/bash (or whatever is the default shell)
  2. PaneInfo has terminal_command set to Some("/bin/bash") instead of None, marking it as a command pane
    /// If this is a command pane, this will show the stringified version of the command and its
    /// arguments
    pub terminal_command: Option<String>,

Minimal reproduction

use zellij_tile::prelude::*;

use std::collections::BTreeMap;

#[derive(Default)]
struct State {}

register_plugin!(State);

impl ZellijPlugin for State {
    fn load(&mut self, _configuration: BTreeMap<String, String>) {
        request_permission(&[
            PermissionType::OpenTerminalsOrPlugins,
            PermissionType::ReadApplicationState,
        ]);
    }
    fn update(&mut self, _event: Event) -> bool {
        open_terminal("./");
        close_self();
        false
    }
    fn render(&mut self, _rows: usize, _cols: usize) {}
}

Run: zellij plugin --skip-plugin-cache -- file:/path/to/rust-plugin-example/target/wasm32-wasi/debug/rust-plugin-example.wasm
This should (after granting permissions) simply open a new pane with the described behavior.

Other relevant information

This was likely introduced with this PR: #3296

@imsnif imsnif self-assigned this Dec 16, 2024
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

No branches or pull requests

2 participants