adds zoom status to tab bar

This commit is contained in:
Dennis 2025-08-12 15:34:06 +02:00
parent 192ae592bc
commit 63a0fc9af6
2 changed files with 16 additions and 5 deletions

View file

@ -52,8 +52,21 @@ function M.move_pane(key, direction)
} }
end end
function M.get_zoom_state(active_pane) function M.get_is_zoomed(for_window)
if active_pane.is_zoomed then local tab = for_window:active_tab()
local panes_info = tab:panes_with_info()
for _, pane_info in ipairs(panes_info) do
if pane_info.is_active then
return pane_info.is_zoomed
end
end
end
function M.get_zoomed_status(for_window)
local is_zoomed = M.get_is_zoomed(for_window)
if is_zoomed then
return "[Z]" return "[Z]"
end end

View file

@ -5,17 +5,15 @@ local helpers = require("helpers")
local M = {} local M = {}
local function get_elements(for_window) local function get_elements(for_window)
local active_pane = for_window:active_pane()
return { return {
{ Background = { Color = theme.colors().tab_bar.background } }, { Background = { Color = theme.colors().tab_bar.background } },
{ Foreground = { Color = theme.colors().tab_bar.inactive_tab.fg_color } }, { Foreground = { Color = theme.colors().tab_bar.inactive_tab.fg_color } },
{ Text = helpers.get_zoom_state(active_pane) .. " " },
{ Text = "h:" .. wezterm.hostname() .. " " }, { Text = "h:" .. wezterm.hostname() .. " " },
{ Text = "upgrades:" .. helpers.get_outdated_packages() .. " " }, { Text = "upgrades:" .. helpers.get_outdated_packages() .. " " },
{ Text = "bat:" .. helpers.get_primary_battery_state() .. " " }, { Text = "bat:" .. helpers.get_primary_battery_state() .. " " },
{ Background = { Color = theme.colors().tab_bar.active_tab.bg_color } }, { Background = { Color = theme.colors().tab_bar.active_tab.bg_color } },
{ Foreground = { Color = theme.colors().tab_bar.active_tab.fg_color } }, { Foreground = { Color = theme.colors().tab_bar.active_tab.fg_color } },
{ Text = helpers.get_zoomed_status(for_window) .. " " },
{ Text = " session >> " .. for_window:active_workspace() .. " " }, { Text = " session >> " .. for_window:active_workspace() .. " " },
} }
end end