Skip to content

Commit c4e1953

Browse files
feat: implement switching between active workspaces (#5)
1 parent e7e1401 commit c4e1953

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
A tmux like sessionizer for Wezterm that was inspired by [ThePrimeagen's tmux-sessionizer](https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer)
66

7+
The sessionizer allows for opening of windows/sessions based on the passed in
8+
directories, as well as fast and intuative switching between active
9+
workspaces/sessions
10+
711
## Setup
812

913
An example configuration calling the plugin
@@ -55,6 +59,9 @@ local projects = {
5559
To display the sessionizer all you have to do is press the key combination of
5660
`LEADER` + `f`
5761

62+
To display the active windows/sessions all you have to do is press the key
63+
combination of `LEADER` + `s`
64+
5865
## Change keybinding
5966

6067
To change the keybinding from the default (`LEADER` + `f`):

plugin/init.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ local get_directories = function()
5656
return folders
5757
end
5858

59-
---The switching of the workspaces
59+
---The switching between workspaces
6060
local workspace_switcher = function()
6161
return wezterm.action_callback(function(window, pane)
6262
local workspaces = get_directories()
@@ -108,6 +108,11 @@ local workspace_switcher = function()
108108
end)
109109
end
110110

111+
---List the active workspaces
112+
local active_workspaces = function()
113+
return act.ShowLauncherArgs { flags = "FUZZY|WORKSPACES" }
114+
end
115+
111116
---Configure the default key bindings
112117
---@param config table
113118
local configure = function(config)
@@ -120,7 +125,7 @@ local configure = function(config)
120125
table.insert(config.keys, {
121126
key = "s",
122127
mods = "LEADER",
123-
action = wezterm.action.ShowLauncherArgs { flags = "FUZZY|TABS" }
128+
action = active_workspaces()
124129
})
125130
end
126131

@@ -133,5 +138,6 @@ end
133138
return {
134139
configure = configure,
135140
set_projects = set_projects,
136-
switch_workspace = workspace_switcher
141+
switch_workspace = workspace_switcher,
142+
active_workspaces = active_workspaces
137143
}

0 commit comments

Comments
 (0)