Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WezTerm zoom support #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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