caio.co/de/dotfiles


wezterm: reduce brightness of inactive panes 💬 by Caio 2 months ago (log)
spring has come

Blob config/wezterm/wezterm.lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
local wezterm = require('wezterm')

local config = wezterm.config_builder()

config.font = wezterm.font('JetBrains Mono')
config.font_size = 12.0

config.hide_tab_bar_if_only_one_tab = true
config.unzoom_on_switch_pane = true
config.tab_bar_at_bottom = true
config.use_fancy_tab_bar = false
config.scrollback_lines = 10000

config.color_schemes = require('schemes')
config.color_scheme = 'light'

config.inactive_pane_hsb = {
  saturation = 1.0,
  brightness = 0.8,
}

local scheme = config.color_schemes[config.color_scheme]

local bg = scheme.background
local fg = scheme.foreground

config.colors = {
  tab_bar = {
    background = bg,

    active_tab = {
      bg_color = fg,
      fg_color = bg,
      intensity = 'Bold',
    },

    inactive_tab = {
      bg_color = bg,
      fg_color = fg,
    },

    new_tab = {
      bg_color = bg,
      fg_color = fg,
    },

    new_tab_hover = {
      bg_color = bg,
      fg_color = fg,
    },
  }
}

config.window_padding = {
  left = 0,
  right = 0,
  top = 0,
  bottom = 0,
}

local function tab_title(tab_info)
  local title = tab_info.tab_title
  -- if the tab title is explicitly set, take that
  if title and #title > 0 then
    return title
  end
  -- Otherwise, use the title from the active pane in that tab
  return tab_info.active_pane.title
end

wezterm.on(
  'format-tab-title',
  function(tab, _, _, _, _, max_width)
    local background = bg
    local foreground = fg

    local title = tab_title(tab)
    if tab.is_active then
      title = wezterm.truncate_right(title, max_width)
      background = fg
      foreground = bg
    else
      title = wezterm.truncate_right((tab.tab_index + 1) .. ':' .. title, max_width)
    end

    return {
      { Text = ' '},
      { Background = { Color = background } },
      { Foreground = { Color = foreground } },
      { Text = title },
      { Text = ' '},
    }
  end
)

require('keys').setup(config)

return config