Skip to content

Commit d1fe2a8

Browse files
committed
update readme with new events
1 parent 289dc5d commit d1fe2a8

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,34 @@ If you want your project switcher only to select projects from this list, but st
7878
Adding the path as a part of the right-status can be done with the `smart_workspace_switcher.workspace_chosen` event which is emitted when choosing the workspace.
7979

8080
```lua
81-
wezterm.on("smart_workspace_switcher.workspace_chosen", function(window, path)
81+
wezterm.on("smart_workspace_switcher.workspace_switcher.chosen", function(window, path)
8282
local base_path = string.gsub(path, "(.*[/\\])(.*)", "%2")
8383
window:set_right_status(wezterm.format({
8484
{ Foreground = { Color = colors.colors.ansi[5] } },
8585
{ Text = base_path .. " " },
8686
}))
8787
end)
88+
89+
wezterm.on("smart_workspace_switcher.workspace_switcher.created", function(window, path)
90+
local base_path = string.gsub(path, "(.*[/\\])(.*)", "%2")
91+
window:set_right_status(wezterm.format({
92+
{ Foreground = { Color = colors.colors.ansi[5] } },
93+
{ Text = base_path .. " " },
94+
}))
95+
end)
96+
8897
```
8998

90-
#### Callbacks when switching workspace
91-
Use the `smart_workspace_switcher.workspace_chosen` event which is emitted when choosing the workspace to add a callback function.
99+
#### Events
100+
Use the events which are emitted when choosing the workspace to add a callback function. The following events are available:
101+
* `smart_workspace_switcher.workspace_switcher.start` - when the fuzzy finder starts
102+
* `smart_workspace_switcher.workspace_switcher.selected` - when a element is selected
103+
* `smart_workspace_switcher.workspace_switcher.created` - after a new workspace is created and switched to upon selecting
104+
* `smart_workspace_switcher.workspace_switcher.chosen` - after switching to a new workspace upon selecting
105+
106+
See example for use below:
92107
```lua
93-
wezterm.on("smart_workspace_switcher.workspace_chosen", function(window, path)
108+
wezterm.on("smart_workspace_switcher.workspace_switcher.chosen", function(window, path)
94109
wezterm.log_info("THIS IS EMITTED FROM THE CALLBACK")
95110
end)
96111
```

0 commit comments

Comments
 (0)