2 2 local wez
= require 'wezterm' 3 3 local bat
= require 'bugabinga.battery' 4 4 local agent
= require 'bugabinga.agent' 6 7 local nugu_dark
= require 'bugabinga.nugu.palette_dark'.palette
7 9 local nugu_light
= require 'bugabinga.nugu.palette_light'.palette
8 10 local palette
= nugu_dark
15 17 claude
= wez.nerdfonts.md_robot_outline,
16 18 cmus
= wez.nerdfonts.md_music,
17 19 code
= wez.nerdfonts.custom_neovim,
18 - codex
= wez.nerdfonts.cod_openai,
19 21 edit
= wez.nerdfonts.custom_neovim,
20 22 fd
= wez.nerdfonts.md_folder_search_outline,
21 23 fin
= wez.nerdfonts.md_magnify,
74 76 local basename = function ( value )
75 77 if not value
or value
== '' then return nil end 76 78 value
= value:gsub(
'\\',
'/' ):gsub(
'/+$',
'' )
77 - return value:match(
'([^/]+)$' )
or value
79 + return value:match
'([^/]+)$' or value
80 82 local use_palette_for_scheme = function ( scheme )
131 133 name
= name:lower()
132 134 if lower:sub(
1,
#name )
~= name
then return false end 133 135 local boundary
= lower:sub(
#name
+ 1,
#name
+ 1 )
134 - return boundary
== '' or boundary:match(
'%W' )
~= nil 136 + return boundary
== '' or boundary:match
'%W' ~= nil 137 139 local function pane_project( pane )
186 188 if triple:find(
'windows',
1,
true )
then return 'WIN', wez.nerdfonts.dev_windows
or ' ', palette.warning
end 187 189 if triple:find(
'darwin',
1,
true )
then return 'MAC', wez.nerdfonts.dev_apple
or ' ', palette.ui.important_local
end 188 190 if triple:find(
'linux',
1,
true )
then return 'LIN', wez.nerdfonts.dev_linux
or ' ', palette.ui.important_local
end 189 - if triple:find(
'bsd',
1,
true )
then return 'BSD', wez.nerdfonts.dev_freebsd
or ' ', palette.ui.important_local
end 191 + if triple:find(
'bsd',
1,
true )
then return 'BSD', wez.nerdfonts.md_freebsd
or ' ', palette.ui.important_local
end 190 192 return 'LOC', wez.nerdfonts.cod_terminal
or ' ', palette.ui.important_local
195 197 if not domain
or domain
== 'local' or domain
== 'Local' then return host_domain()
end 196 198 if domain:find(
'^WSL:',
1,
false )
then return 'WSL', wez.nerdfonts.dev_linux
or ' ', palette.ui.important_local
end 197 199 if domain:find(
'^scope:',
1,
false )
then return 'EXE', wez.nerdfonts.cod_gear
or ' ', palette.warning
end 198 - return ( domain:upper():gsub(
'[^%w]',
'' ):sub(
1,
3 )
.. 'LOC' ):sub(
1,
3 ), wez.nerdfonts.cod_terminal
or ' ', palette.ui.important_local
200 + return (domain:upper():gsub(
'[^%w]',
'' ):sub(
1,
3 )
.. 'LOC'):sub(
1,
3 ), wez.nerdfonts.cod_terminal
or ' ',
201 + palette.ui.important_local
201 204 wez.on(
'format-tab-title',
function ( tab, tabs, panes, config, hover, max_width )
222 225 label
= wez.truncate_right( label,
math.
max(
1, max_width
or 32 ) )
225 - {
Background = {
Color = bg } },
226 - {
Foreground = {
Color = fg } },
227 - {
Attribute = {
Intensity = tab.is_active
and 'Bold' or 'Normal' } },
228 + {
Background = {
Color = bg, }, },
229 + {
Foreground = {
Color = fg, }, },
230 + {
Attribute = {
Intensity = tab.is_active
and 'Bold' or 'Normal', }, },
229 232 'ResetAttributes',
247 250 if window:leader_is_active()
then key_table
= 'LEADER' end 248 251 if key_table
then 250 - {
Background = {
Color = palette.error } },
251 - {
Foreground = {
Color = palette.ui.backdrop } },
252 - {
Attribute = {
Intensity =
'Bold' } },
253 - {
Text =
' ' .. key_table
.. ' ' },
253 + {
Background = {
Color = palette.error, }, },
254 + {
Foreground = {
Color = palette.ui.backdrop, }, },
255 + {
Attribute = {
Intensity =
'Bold', }, },
256 + {
Text =
' ' .. key_table
.. ' ', },
254 257 'ResetAttributes',
259 262 local ok_zoom, zoomed_state
= pcall( zoomed, pane )
260 263 if ok_zoom
and zoomed_state
then 261 - table.
insert( right, {
Foreground = {
Color = palette.ui.minor } } )
262 - table.
insert( right, {
Text = zoomed_state
.. ' ' } )
264 + table.
insert( right, {
Foreground = {
Color = palette.ui.minor, }, } )
265 + table.
insert( right, {
Text = zoomed_state
.. ' ', } )
264 267 window:set_right_status( wez.format( right ) )
271 274 local workspace
= workspace_chips( window:active_workspace() )
273 276 window:set_left_status( wez.format {
274 - {
Text = battery },
275 - {
Foreground = {
Color = palette.ui.important_local } },
276 - {
Attribute = {
Intensity =
'Bold' } },
277 - {
Text =
'● ' .. workspace
.. ' ' },
278 - {
Foreground = {
Color = domain_color } },
279 - {
Text = domain_icon
.. ' ' .. domain_text
.. ' ' },
277 + {
Text = battery, },
278 + {
Foreground = {
Color = palette.ui.important_local, }, },
280 + {
Attribute = {
Intensity =
'Bold', }, },
281 + {
Text =
'● ' .. workspace
.. ' ', },
282 + {
Foreground = {
Color = domain_color, }, },
283 + {
Text = domain_icon
.. ' ' .. domain_text
.. ' ', },
280 284 'ResetAttributes',
284 288 if not ok_status
then 285 289 wez.log_error(
'status render failed: ' .. tostring( status_error ) )
286 290 window:set_right_status( wez.format {
287 - {
Foreground = {
Color = palette.error } },
288 - {
Text =
' status error ' },
291 + {
Foreground = {
Color = palette.error, }, },
292 + {
Text =
' status error ', },
293 297 return function ( cfg )
294 299 cfg.enable_tab_bar
= true 295 300 cfg.hide_tab_bar_if_only_one_tab
= false 296 301 cfg.use_fancy_tab_bar
= false