diff --git a/docs/en/src/configuration.md b/docs/en/src/configuration.md index 0be0ac4..5173ef9 100644 --- a/docs/en/src/configuration.md +++ b/docs/en/src/configuration.md @@ -53,8 +53,6 @@ Renders the first column in the table #### xplr.fn.builtin.fmt_general_table_row_cols_1 -Renders the second column in the table - #### xplr.fn.builtin.fmt_general_table_row_cols_2 Renders the third column in the table @@ -115,5 +113,21 @@ return { { LogSuccess = "Changed focus" }, { CallLuaSilently = "custom.some_plugin_with_hooks.on_focus_change" }, } + + -- Add messages to send when the mode is switched. + -- + -- Type: list of [Message](https://xplr.dev/en/message#message)s + on_mode_switch = { + { LogSuccess = "Switched mode" }, + { CallLuaSilently = "custom.some_plugin_with_hooks.on_mode_switch" }, + } + + -- Add messages to send when the layout is switched + -- + -- Type: list of [Message](https://xplr.dev/en/message#message)s + on_layout_switch = { + { LogSuccess = "Switched layout" }, + { CallLuaSilently = "custom.some_plugin_with_hooks.on_layout_switch" }, + } } ``` diff --git a/src/app.rs b/src/app.rs index acda1b4..3d40320 100644 --- a/src/app.rs +++ b/src/app.rs @@ -382,7 +382,7 @@ impl App { self } - pub fn handle_batch_external_msgs(self, msgs: Vec) -> Result { + pub fn handle_batch_external_msgs(mut self, msgs: Vec) -> Result { for task in msgs .into_iter() .map(|msg| Task::new(MsgIn::External(msg), None)) diff --git a/src/init.lua b/src/init.lua index faf943a..33123b5 100644 --- a/src/init.lua +++ b/src/init.lua @@ -2704,8 +2704,21 @@ xplr.fn.custom = {} -- { CallLuaSilently = "custom.some_plugin_with_hooks.on_focus_change" }, -- } -- --- ... --- } +-- -- Add messages to send when the mode is switched. +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_mode_switch = { +-- { LogSuccess = "Switched mode" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_mode_switch" }, +-- } +-- +-- -- Add messages to send when the layout is switched +-- -- +-- -- Type: list of [Message](https://xplr.dev/en/message#message)s +-- on_layout_switch = { +-- { LogSuccess = "Switched layout" }, +-- { CallLuaSilently = "custom.some_plugin_with_hooks.on_layout_switch" }, +-- } -- ``` return {