Skip to content

Commit b687278

Browse files
author
Patrik Stier
committed
Add WezTerm zoom support
1 parent 91d8650 commit b687278

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lua/Navigator/mux/wezterm.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ function WezTerm:new()
4141
return setmetatable(state, self)
4242
end
4343

44+
---Checks if wezterm is zoomed in
45+
---@return boolean
46+
function WezTerm:zoomed()
47+
local ok, panes = pcall(vim.json.decode, self.execute('list --format json'))
48+
if not ok then
49+
return false
50+
end
51+
local active_pane_id = tonumber(os.getenv('WEZTERM_PANE'))
52+
for _, pane in ipairs(panes) do
53+
if pane.pane_id == active_pane_id then
54+
return pane.is_zoomed
55+
end
56+
end
57+
return false
58+
end
59+
4460
---Switch pane in wezterm
4561
---@param direction Direction See |navigator.api.Direction|
4662
---@return WezTerm

lua/Navigator/utils.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local U = {}
55
---@return unknown
66
function U.execute(cmd)
77
local handle = assert(io.popen(cmd), string.format('[Navigator] Unable to execute cmd - %q', cmd))
8-
local result = handle:read()
8+
local result = handle:read("*a")
99
handle:close()
1010
return result
1111
end

0 commit comments

Comments
 (0)