Skip to content

Commit

Permalink
Add WezTerm zoom support
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrik Stier committed Sep 2, 2023
1 parent 91d8650 commit b687278
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lua/Navigator/mux/wezterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ function WezTerm:new()
return setmetatable(state, self)
end

---Checks if wezterm is zoomed in
---@return boolean
function WezTerm:zoomed()
local ok, panes = pcall(vim.json.decode, self.execute('list --format json'))
if not ok then
return false
end
local active_pane_id = tonumber(os.getenv('WEZTERM_PANE'))
for _, pane in ipairs(panes) do
if pane.pane_id == active_pane_id then
return pane.is_zoomed
end
end
return false
end

---Switch pane in wezterm
---@param direction Direction See |navigator.api.Direction|
---@return WezTerm
Expand Down
2 changes: 1 addition & 1 deletion lua/Navigator/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local U = {}
---@return unknown
function U.execute(cmd)
local handle = assert(io.popen(cmd), string.format('[Navigator] Unable to execute cmd - %q', cmd))
local result = handle:read()
local result = handle:read("*a")
handle:close()
return result
end
Expand Down

0 comments on commit b687278

Please sign in to comment.