{"id":15114305,"url":"https://github.com/MLFlexer/smart_workspace_switcher.wezterm","last_synced_at":"2025-09-27T18:30:38.558Z","repository":{"id":180904164,"uuid":"665890995","full_name":"MLFlexer/smart_workspace_switcher.wezterm","owner":"MLFlexer","description":"A smart wezterm workspace switcher plugin inspired by joshmedeski/t-smart-tmux-session-manager","archived":false,"fork":false,"pushed_at":"2024-11-14T18:21:29.000Z","size":60,"stargazers_count":76,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T19:26:23.604Z","etag":null,"topics":["plugin","sesh","session","session-management","session-manager","wezterm","wezterm-config","wezterm-plugin","wezterm-session","workspace","workspace-management","workspace-manager","workspaces"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MLFlexer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-13T08:25:05.000Z","updated_at":"2024-11-14T18:21:30.000Z","dependencies_parsed_at":"2023-10-16T10:49:52.091Z","dependency_job_id":"bcbe568b-09b7-4e11-ba20-1aa9295ede2a","html_url":"https://github.com/MLFlexer/smart_workspace_switcher.wezterm","commit_stats":null,"previous_names":["mlflexer/smart_workspace_switcher.wezterm"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLFlexer%2Fsmart_workspace_switcher.wezterm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLFlexer%2Fsmart_workspace_switcher.wezterm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLFlexer%2Fsmart_workspace_switcher.wezterm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MLFlexer%2Fsmart_workspace_switcher.wezterm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MLFlexer","download_url":"https://codeload.github.com/MLFlexer/smart_workspace_switcher.wezterm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234450844,"owners_count":18834586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","sesh","session","session-management","session-manager","wezterm","wezterm-config","wezterm-plugin","wezterm-session","workspace","workspace-management","workspace-manager","workspaces"],"created_at":"2024-09-26T01:41:11.436Z","updated_at":"2025-09-27T18:30:38.544Z","avatar_url":"https://github.com/MLFlexer.png","language":"Lua","funding_links":[],"categories":["Session"],"sub_categories":[],"readme":"# smart_workspace_switcher.wezterm\n\nA smart Wezterm workspace switcher inspired by [t-smart-tmux-session-manager](https://github.com/joshmedeski/t-smart-tmux-session-manager) and its successor [sesh](https://github.com/joshmedeski/sesh)\n\n## Usage\n\n💨 Level up your workflow by switching between workspaces ⚡ ***BLAZINGLY FAST*** ⚡ with 1️⃣ keypress, the power of fuzzy finding and zoxide! 💨\n\n![Demo gif](https://github.com/MLFlexer/smart_workspace_switcher.wezterm/assets/75012728/a4f82fcf-5304-4891-a1e2-346767678dc6)\n\n## Dependencies\n\n* zoxide\n\n### Setup\n\n1. Require the plugin:\n\n    ```lua\n    local wezterm = require(\"wezterm\")\n    local workspace_switcher = wezterm.plugin.require(\"https://github.com/MLFlexer/smart_workspace_switcher.wezterm\")\n    ```\n\n2. Apply the default keybinding to the config:\n\n    ```lua\n    workspace_switcher.apply_to_config(config)\n    ```\n\nOr create your own keybinding, see [Configuration - Keybinding](#Keybinding).\n\n### Configuration:\n#### Keybinding\nTo add a custom keybinding:\n\n  ```lua\n  config.keys = {\n    -- ...\n    -- your other keybindings\n    {\n      key = \"s\",\n      mods = \"LEADER\",\n      action = workspace_switcher.switch_workspace(),\n    },\n    {\n      key = \"S\",\n      mods = \"LEADER\",\n      action = workspace_switcher.switch_to_prev_workspace(),\n    }\n  }\n  ```\n\n#### Changing the Default Workspace Name\nYou can set a default workspace name:\n\n```lua\nconfig.default_workspace = \"~\"\n```\n\n#### Additional Filtering\n\nYou can include `extra_args` in the call to `switch_workspace` to filter the results of the zoxide query further. The `extra_args` is just a string concatenated to the command like so: `zoxide query -l \u003cextra_args\u003e`. For example, to select projects from a predefined list in `~/.projects`, call the plugin like this:\n\n  ```lua\n  workspace_switcher.switch_workspace({ extra_args = \" | rg -Fxf ~/.projects\" })\n  ```\n\n#### Changing elements of the fuzzy finder\n\nYou can change the list of elements of the fuzzy finder by setting a new function for `get_choices` likes so:\n\n```lua\nlocal workspace_switcher = wezterm.plugin.require(\"https://github.com/MLFlexer/smart_workspace_switcher.wezterm\")\nworkspace_switcher.get_choices = function(opts)\n  -- this will ONLY show the workspace elements, NOT the Zoxide results\n  return workspace_switcher.choices.get_workspace_elements({})\nend\n```\n\nBy default the function uses the following functions to create a list:\n\n```lua\nworkspace_switcher.choices.get_workspace_elements({ id: string, label: string }[])\nworkspace_switcher.choices.get_zoxide_elements({ id: string, label: string }[], {extra_args?: string, workspace_ids?: workspace_ids}?)\n```\n\n#### Updating the Right Status with the Path\n\nTo add the selected path to the right status bar, use the `smart_workspace_switcher.workspace_switcher.chosen` event emitted when choosing a workspace:\n\n  ```lua\n  wezterm.on(\"smart_workspace_switcher.workspace_switcher.chosen\", function(window, workspace)\n    local gui_win = window:gui_window()\n    local base_path = string.gsub(workspace, \"(.*[/\\\\])(.*)\", \"%2\")\n    gui_win:set_right_status(wezterm.format({\n      { Foreground = { Color = \"green\" } },\n      { Text = base_path .. \"  \" },\n    }))\n  end)\n\n  wezterm.on(\"smart_workspace_switcher.workspace_switcher.created\", function(window, workspace)\n    local gui_win = window:gui_window()\n    local base_path = string.gsub(workspace, \"(.*[/\\\\])(.*)\", \"%2\")\n    gui_win:set_right_status(wezterm.format({\n      { Foreground = { Color = \"green\" } },\n      { Text = base_path .. \"  \" },\n    }))\n  end)\n  ```\n\n#### Events\n\nThe following events are available and can be used to trigger custom behavior:\n\n* `smart_workspace_switcher.workspace_switcher.start` - Triggered when the fuzzy finder starts.\n* `smart_workspace_switcher.workspace_switcher.canceled` - Triggered if no element is chosen.\n* `smart_workspace_switcher.workspace_switcher.selected` - Triggered when an element is selected.\n* `smart_workspace_switcher.workspace_switcher.created` - Triggered after creating and switching to a new workspace.\n* `smart_workspace_switcher.workspace_switcher.chosen` - Triggered after switching to a workspace.\n* `smart_workspace_switcher.workspace_switcher.switched_to_prev` - Triggered after switching to a previous workspace.\n\n\u003e [!NOTE]\n\u003e The `created` and `chosen` events emit [MuxWindow](https://wezfurlong.org/wezterm/config/lua/mux-window/) objects while the others emit [GuiWindow](https://wezfurlong.org/wezterm/config/lua/window/index.html) objects. \n\nExample usage:\n\n  ```lua\n  wezterm.on(\"smart_workspace_switcher.workspace_switcher.chosen\", function(window, workspace)\n    wezterm.log_info(\"THIS IS EMITTED FROM THE CALLBACK\")\n  end)\n  ```\n\n#### Workspace Formatter\n\nSet a custom workspace formatter using the following example. For more information, see the [Wezterm formatting docs](https://wezfurlong.org/wezterm/config/lua/wezterm/format.html):\n\n  ```lua\n  workspace_switcher.workspace_formatter = function(label)\n    return wezterm.format({\n      { Attribute = { Italic = true } },\n      { Foreground = { Color = \"green\" } },\n      { Background = { Color = \"black\" } },\n      { Text = \"󱂬: \" .. label },\n    })\n  end\n  ```\n\n#### Zoxide Path\n\nTo define a custom path to `zoxide`:\n\n  ```lua\n  workspace_switcher.zoxide_path = \"/path/to/zoxide\"\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMLFlexer%2Fsmart_workspace_switcher.wezterm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMLFlexer%2Fsmart_workspace_switcher.wezterm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMLFlexer%2Fsmart_workspace_switcher.wezterm/lists"}