local wez = require 'wezterm' local bat = require 'bugabinga.battery' local DELIMITER = ' ยท ' local ai_shell = require 'bugabinga.ai_shell' local palette = require 'bugabinga.nugu.palette_dark'.palette local zoomed = function ( pane ) local tab = pane:tab() local any_is_zoomed = false if tab then for _, info in ipairs( tab:panes_with_info() ) do if info.is_zoomed then any_is_zoomed = true end end end return any_is_zoomed and '๐Ÿ”Ž Zoomed Pane' or nil end -- Detect special foreground programs via pane title -- (get_foreground_process_info returns nil on this system) local detect_program = function ( pane ) local ok, title = pcall( pane.get_title, pane ) if not ok or not title then return nil end if title:find( 'ฯ€' ) then return 'pi' end return nil end -- Show which key table is active in the status area wez.on( 'update-status', function ( window, pane ) local key_table = window:active_key_table() local current_workspace = window:active_workspace() local zoomed_state_ok, zoomed_state = pcall(zoomed, pane) zoomed_state = zoomed_state_ok and zoomed_state or nil local leader = nil if window:leader_is_active() then leader = '๓ฑ ' end local pane_domain_ok, pane_domain = pcall(pane.get_domain_name, pane) if not pane_domain_ok then return end local os_icon = wez.target_triple:find 'windows' and '๎œ ' or '๎ฏ† ' local time = wez.time.now():format '%H:%M' local ai_status = ai_shell.get_status(window) local status = { time, os_icon, ai_status, leader, } -- Special program indicators local prog = detect_program( pane ) if prog == 'pi' then table.insert( status, wez.format { { Foreground = { Color = '#d151d1' } }, { Attribute = { Intensity = 'Bold' } }, { Text = 'pi' }, } ) end if key_table then table.insert( status, key_table ) end if zoomed_state then table.insert( status, zoomed_state ) end local context = wez.format { { Text = current_workspace, }, { Text = '@', }, { Attribute = { Intensity = 'Bold', }, }, { Text = pane_domain, }, } table.insert( status, context ) local right_elements = { { Text = table.concat( status, DELIMITER ), }, } if key_table then table.insert( right_elements, { Text = DELIMITER } ) table.insert( right_elements, { Background = { Color = palette.error, }, } ) table.insert( right_elements, { Foreground = { Color = palette.ui.backdrop, }, } ) table.insert( right_elements, { Text = ' ' .. key_table .. ' ', } ) end window:set_right_status( wez.format( right_elements ) ) local battery_icons = bat.get_battery_icons() if battery_icons ~= '' then battery_icons = battery_icons .. ' ' end window:set_left_status( wez.format { { Text = ' ๎žข ', }, { Text = battery_icons, }, } ) end ) return function ( cfg ) cfg.enable_tab_bar = true -- if this is hidden, we cannot see the right status are cfg.hide_tab_bar_if_only_one_tab = false cfg.use_fancy_tab_bar = false cfg.tab_max_width = 42 cfg.tab_bar_at_bottom = true cfg.status_update_interval = 1000 end