Skip to content

Commit

Permalink
feat(ui): built-in plugin manager (zellij-org#3633)
Browse files Browse the repository at this point in the history
* add plugin list to session info

* feat(plugins): new_plugin and reload_plugin API commands

* feat(plugins): built-in plugin manager

* style(fmt): rustfmt

* update plugins
  • Loading branch information
imsnif committed Dec 31, 2024
1 parent e25b1eb commit 0e56366
Show file tree
Hide file tree
Showing 48 changed files with 2,095 additions and 133 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ members = [
"default-plugins/fixture-plugin-for-tests",
"default-plugins/session-manager",
"default-plugins/configuration",
"default-plugins/plugin-manager",
"zellij-client",
"zellij-server",
"zellij-utils",
Expand Down
42 changes: 42 additions & 0 deletions default-plugins/configuration/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,13 @@ keybinds clear-defaults=true {{
}};
SwitchToMode "Locked"
}}
bind "p" {{
LaunchOrFocusPlugin "plugin-manager" {{
floating true
move_to_focused_tab true
}};
SwitchToMode "Locked"
}}
}}
shared_except "locked" "renametab" "renamepane" {{
bind "{primary_modifier} g" {{ SwitchToMode "Locked"; }}
Expand Down Expand Up @@ -1475,6 +1482,13 @@ keybinds clear-defaults=true {{
}};
SwitchToMode "Normal"
}}
bind "p" {{
LaunchOrFocusPlugin "plugin-manager" {{
floating true
move_to_focused_tab true
}};
SwitchToMode "Normal"
}}
}}
tmux {{
bind "[" {{ SwitchToMode "Scroll"; }}
Expand Down Expand Up @@ -1658,6 +1672,13 @@ keybinds clear-defaults=true {{
}};
SwitchToMode "Normal"
}}
bind "p" {{
LaunchOrFocusPlugin "plugin-manager" {{
floating true
move_to_focused_tab true
}};
SwitchToMode "Normal"
}}
}}
tmux {{
bind "[" {{ SwitchToMode "Scroll"; }}
Expand Down Expand Up @@ -1830,6 +1851,13 @@ keybinds clear-defaults=true {{
}};
SwitchToMode "Normal"
}}
bind "p" {{
LaunchOrFocusPlugin "plugin-manager" {{
floating true
move_to_focused_tab true
}};
SwitchToMode "Normal"
}}
}}
tmux {{
bind "[" {{ SwitchToMode "Scroll"; }}
Expand Down Expand Up @@ -2004,6 +2032,13 @@ keybinds clear-defaults=true {{
}};
SwitchToMode "Normal"
}}
bind "p" {{
LaunchOrFocusPlugin "plugin-manager" {{
floating true
move_to_focused_tab true
}};
SwitchToMode "Normal"
}}
}}
tmux {{
bind "[" {{ SwitchToMode "Scroll"; }}
Expand Down Expand Up @@ -2162,6 +2197,13 @@ keybinds clear-defaults=true {{
}};
SwitchToMode "Normal"
}}
bind "p" {{
LaunchOrFocusPlugin "plugin-manager" {{
floating true
move_to_focused_tab true
}};
SwitchToMode "Normal"
}}
}}
tmux {{
bind "[" {{ SwitchToMode "Scroll"; }}
Expand Down
14 changes: 14 additions & 0 deletions default-plugins/fixture-plugin-for-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,20 @@ impl ZellijPlugin for State {
should_change_focus_to_target_tab,
);
},
BareKey::Char('w') if key.has_modifiers(&[KeyModifier::Alt]) => {
reload_plugin_with_id(0);
},
BareKey::Char('x') if key.has_modifiers(&[KeyModifier::Alt]) => {
let config = BTreeMap::new();
let load_in_background = true;
let skip_plugin_cache = true;
load_new_plugin(
"zellij:OWN_URL",
config,
load_in_background,
skip_plugin_cache,
)
},
_ => {},
},
Event::CustomMessage(message, payload) => {
Expand Down
2 changes: 2 additions & 0 deletions default-plugins/plugin-manager/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
target = "wasm32-wasi"
1 change: 1 addition & 0 deletions default-plugins/plugin-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
10 changes: 10 additions & 0 deletions default-plugins/plugin-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "plugin-manager"
version = "0.1.0"
authors = ["Aram Drevekenin <aram@poor.dev>"]
edition = "2018"

[dependencies]
uuid = { version = "1.7.0", features = ["v4"] }
fuzzy-matcher = "0.3.7"
zellij-tile = { path = "../../zellij-tile" }
1 change: 1 addition & 0 deletions default-plugins/plugin-manager/LICENSE.md
Loading

0 comments on commit 0e56366

Please sign in to comment.