Launching workspaces from outside wezterm using fzf #6406
aniketgm
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Few months back, I had asked this, and I wanted something I could launch from outside. By outside, I meant really outside (outside of wezterm). Although, the solution presented in that post was helpful and I worked with it for a while. However, I was not very happy with it. Now, I have written this small script which can help Launch workspaces outside of wezterm.
If anyone knows how to achieve this from within wezterm using lua (I'm not yet good with lua), please share. NOTE, I'm looking for something where workspaces are not loaded and no keybinding.
This is written in PowerShell since I use Windows for work
¯\_(ツ)_/¯
. However, not to worry, it's very very easy to understand (see the comments in the code and Explanation section below). So for folks who don't like Windows, I believe one can easily replicate the same on bash OR other shells, since the wezterm cli commands will remain the same. If anyone comes up with a bash, they can share it here. Hope all this helps.Workspace Launcher
Workspace Configuration File: wezterm_workspaces.json
Explanation
wz
takes three parameters (self explanatory) which become the options of the commandwz
. The Switch (Switch is a boolean parameter -- powershell feature)WSLaunch
, will open a fzf prompt. Then whichever workspace we select, it will launch that workspace using the commands mentioned in the blockElseIf ($WSLaunch.IsPresent)
LaunchWS
does the "magic" of launching the workspace. It takes two params, one for workspace name, the other is a PSCustomObject (similar to dictionary in python having key and value), which is an object converted from json usingConvertFrom-Json
.One can customize this further to add new features to this script. Happy Wezzing..
Beta Was this translation helpful? Give feedback.
All reactions