From 63a0fc9af6ab592249300a809e112ffe8ad45732 Mon Sep 17 00:00:00 2001 From: Dennis Date: Tue, 12 Aug 2025 15:34:06 +0200 Subject: [PATCH] adds zoom status to tab bar --- modules/wezterm/config/helpers.lua | 17 +++++++++++++++-- modules/wezterm/config/tab_bar.lua | 4 +--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/wezterm/config/helpers.lua b/modules/wezterm/config/helpers.lua index fd504ca..f9729c2 100644 --- a/modules/wezterm/config/helpers.lua +++ b/modules/wezterm/config/helpers.lua @@ -52,8 +52,21 @@ function M.move_pane(key, direction) } end -function M.get_zoom_state(active_pane) - if active_pane.is_zoomed then +function M.get_is_zoomed(for_window) + 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]" end diff --git a/modules/wezterm/config/tab_bar.lua b/modules/wezterm/config/tab_bar.lua index fa4411e..ef65593 100644 --- a/modules/wezterm/config/tab_bar.lua +++ b/modules/wezterm/config/tab_bar.lua @@ -5,17 +5,15 @@ local helpers = require("helpers") local M = {} local function get_elements(for_window) - local active_pane = for_window:active_pane() - return { { Background = { Color = theme.colors().tab_bar.background } }, { Foreground = { Color = theme.colors().tab_bar.inactive_tab.fg_color } }, - { Text = helpers.get_zoom_state(active_pane) .. " " }, { Text = "h:" .. wezterm.hostname() .. " " }, { Text = "upgrades:" .. helpers.get_outdated_packages() .. " " }, { Text = "bat:" .. helpers.get_primary_battery_state() .. " " }, { Background = { Color = theme.colors().tab_bar.active_tab.bg_color } }, { Foreground = { Color = theme.colors().tab_bar.active_tab.fg_color } }, + { Text = helpers.get_zoomed_status(for_window) .. " " }, { Text = " session >> " .. for_window:active_workspace() .. " " }, } end