Switch to Last / Previous Workspace - Solution #5833
tjex
started this conversation in
Show and tell
Replies: 2 comments
-
@tjex wow nice work ^^ |
Beta Was this translation helpful? Give feedback.
0 replies
-
@krispouille Found a few things in need of tweaking. Here is a non-permalink link to main for the up to date state. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Finally scratched that itch. And it feels so good.
Basically, when changing to a workspace, a
previous_workspace
field inwezterm.GLOBAL
is updated with the current workspace. The functionswitch_to_previous_workspace()
then accesses that field when being executed.There are two functions needed for this to work. One for toggling between the last workspaces. And one for updating the previous workspace when we change workspaces via other means than toggling between them.
My full wezterm conf
Solution
see in full context
Keybinds
A keybind would be set like this:
Note
What's essential, is that any calls to
wezterm.action.SwitchToWorkspace
need to be replaced with theswitch_workspace()
function, which is effectively a wrapper around this call along with thewezterm.GLOBAL.previous_workspace
logic.Or if that's too clunky to bake into another functionality, you can also update the
previous_workspace
field before switching workspaces, like here in the sessionizer function (discussion here).see in full context
Beta Was this translation helpful? Give feedback.
All reactions