Files
dotfiles/wezterm/.wezterm.lua

171 lines
4.6 KiB
Lua

local wezterm = require 'wezterm'
local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")
local config = wezterm.config_builder()
config.color_scheme = 'Ayu Dark (Gogh)'
config.bidi_enabled = true
config.enable_kitty_graphics = true
config.default_cursor_style = 'BlinkingBlock'
config.animation_fps = 24
config.cursor_blink_rate = 600
config.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0
}
config.font = wezterm.font 'Fira Code Nerd Font'
local function weather()
if fetch_cache.weather.text == nil or os.clock() - fetch_cache.weather.last > fetch_cache.weather.secs then
local success, stdout, _ = wezterm.run_child_process {'curl', 'wttr.in?format=%c%t'}
if success then
local parts = strsplit(stdout)
fetch_cache.weather.text = string.format(' %s%s ', parts[1], parts[2])
else
fetch_cache.weather.text = ''
end
fetch_cache.weather.last = os.clock()
end
return fetch_cache.weather.text
end
local function datetime()
-- local time_format = '%H:%M %d/%m'
local time_format = '%H:%M'
local time_icon = wezterm.nerdfonts['weather_time_'..tonumber(os.date('%I'))]
return string.format(' %s %s ', time_icon, os.date(time_format))
end
local function battery()
local bat = ''
for _, b in ipairs(wezterm.battery_info()) do
local battery_icon_prefix = 'md_battery_'
if b.state == 'Charging' then
battery_icon_prefix = battery_icon_prefix..'charging_'
end
local charge_icon = wezterm.nerdfonts[battery_icon_prefix..math.floor(b.state_of_charge * 10)*10]
if charge_icon == nil then
charge_icon = wezterm.nerdfonts.md_battery_alert_variant_outline
end
bat = string.format(' %s %.0f%%', charge_icon, b.state_of_charge*100)
end
return bat
end
local colors = {
bg = '#0B0E14',
fg = '#bbc2cf',
fg_idle = '#8A9199',
accent = '#FFAA33',
ui = '#8A9199',
mir_accent = '#FFCC66',
mir_bg = '#1F2430',
mir_fg = '#CCCAC2',
mir_ui = '#707A8C',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
tabline.setup{
options = {
theme = 'Ayu Dark (Gogh)',
tab_separators = {
left = '',
right = '',
-- left = wezterm.nerdfonts.pl_left_hard_divider,
-- right = wezterm.nerdfonts.pl_right_hard_divider,
},
component_separators = {
-- left = '',
-- right = '',
left = wezterm.nerdfonts.pl_left_soft_divider,
right = wezterm.nerdfonts.pl_right_soft_divider,
},
section_separators = {
left = wezterm.nerdfonts.pl_left_hard_divider,
right = wezterm.nerdfonts.pl_right_hard_divider,
-- right = wezterm.nerdfonts.pl_right_soft_divider,
},
color_overrides = {
normal_mode = {
a = { fg = colors.mir_bg, bg = colors.mir_accent },
-- b = { fg = colors.fg, bg = colors.bg },
x = { fg = colors.mir_ui},
y = { fg = colors.mir_accent, bg = colors.mir_bg },
z = { fg = colors.mir_bg, bg = colors.mir_acent },
},
tab = {
active = { fg = colors.mir_accent, bg = colors.mir_bg },
inactive = { fg = colors.mir_ui, bg = colors.bg },
},
},
},
sections = {
-- tabline_a = { { 'workspace', padding = {left = 1, right = 1}}},
tabline_b = {},
tabline_c = { ' ' },
-- tab_active = {
-- 'index',
-- {
-- 'process',
-- padding = { left = 0, right = 1 },
-- },
-- },
-- tab_inactive = {
-- 'index',
-- {
-- 'process',
-- padding = { left = 0, right = 1 },
-- },
-- },
-- tab_inactive = { 'index', { 'process', padding = { left = 0, right = 1 } } },
tab_active = { {Attribute = {Intensity = "Bold"}}, 'index', 'process' },
tab_inactive = { 'index' },
tabline_x = {
-- currently_playing,
},
tabline_y = {
'cpu',
'ram',
-- weather,
-- datetime,
},
tabline_z = {
'battery',
-- battery,
-- {
-- 'hostname',
-- },
},
},
extensions = {
-- 'smart_workspace_switcher',
-- 'resurrect',
}
}
config.use_fancy_tab_bar=false
config.tab_bar_at_bottom=true
config.show_tabs_in_tab_bar=true
config.hide_tab_bar_if_only_one_tab=false
config.show_new_tab_button_in_tab_bar=false
config.tab_max_width=32
config.colors = config.colors or {}
config.colors.tab_bar = config.colors.tab_bar or {}
config.colors.tab_bar.background = colors.bg
config.status_update_interval = 500
return config