From 1fda3b719adb47e32d051812e569cca64134373d Mon Sep 17 00:00:00 2001 From: rootiest Date: Fri, 4 Oct 2024 11:08:03 -0400 Subject: [PATCH] feat: workspace switcher -- Adds some command pallete options for workspace management --- plugins/ws_switcher.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plugins/ws_switcher.lua diff --git a/plugins/ws_switcher.lua b/plugins/ws_switcher.lua new file mode 100644 index 0000000..ad61fb7 --- /dev/null +++ b/plugins/ws_switcher.lua @@ -0,0 +1,33 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ WORKSPACE SWITCHER │ +-- ╰─────────────────────────────────────────────────────────╯ + +local M = {} + +WORKSPACE_SWITCHER = WEZTERM.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm") + +WEZTERM.on("augment-command-palette", function() + local workspace_state = RESURRECT.workspace_state + return { + { + brief = "Window | Workspace: Switch Workspace", + icon = "md_briefcase_arrow_up_down", + action = WORKSPACE_SWITCHER.switch_workspace(), + }, + { + brief = "Window | Workspace: Rename Workspace", + icon = "md_briefcase_edit", + action = WEZTERM.action.PromptInputLine({ + description = "Enter new name for workspace", + action = WEZTERM.action_callback(function(_, _, line) + if line then + WEZTERM.mux.rename_workspace(WEZTERM.mux.get_active_workspace(), line) + RESURRECT.save_state(workspace_state.get_workspace_state()) + end + end), + }), + }, + } +end) + +return M