commit 1280a0fdf65d98b944773dc902b45aad46c13a5e Author: Valeri Date: Mon Aug 17 22:58:27 2026 -0300 feat: configuración de WezTerm con temas visuales y skill de personalización diff --git a/.agents/skills/wezterm/SKILL.md b/.agents/skills/wezterm/SKILL.md new file mode 100644 index 0000000..f6b0046 --- /dev/null +++ b/.agents/skills/wezterm/SKILL.md @@ -0,0 +1,259 @@ +--- +name: wezterm +description: Configure and customize WezTerm terminal emulator. Use for setting up WezTerm config, themes, keybindings, and advanced features. +--- + +# WezTerm Configuration + +Configure the WezTerm terminal emulator. + +## Prerequisites + +```bash +# Install WezTerm +brew install --cask wezterm +``` + +Config location: `~/.wezterm.lua` or `~/.config/wezterm/wezterm.lua` + +## Basic Configuration + +### Minimal Config + +```lua +-- ~/.wezterm.lua +local wezterm = require 'wezterm' +local config = wezterm.config_builder() + +-- Font +config.font = wezterm.font('JetBrains Mono') +config.font_size = 14.0 + +-- Colors +config.color_scheme = 'Catppuccin Mocha' + +-- Window +config.window_padding = { + left = 10, + right = 10, + top = 10, + bottom = 10, +} + +return config +``` + +### Font Configuration + +```lua +-- Single font +config.font = wezterm.font('JetBrains Mono') + +-- Font with fallbacks +config.font = wezterm.font_with_fallback({ + 'JetBrains Mono', + 'Fira Code', + 'Nerd Font Symbols', +}) + +-- Font with weight +config.font = wezterm.font('JetBrains Mono', { weight = 'Medium' }) + +-- Different font for bold +config.font_rules = { + { + intensity = 'Bold', + font = wezterm.font('JetBrains Mono', { weight = 'Bold' }), + }, +} +``` + +### Color Schemes + +```lua +-- Use built-in scheme +config.color_scheme = 'Catppuccin Mocha' + +-- List available schemes +-- wezterm show-keys --lua + +-- Custom colors +config.colors = { + foreground = '#c0caf5', + background = '#1a1b26', + cursor_bg = '#c0caf5', + selection_bg = '#33467c', + ansi = {'#15161e', '#f7768e', '#9ece6a', '#e0af68', '#7aa2f7', '#bb9af7', '#7dcfff', '#a9b1d6'}, + brights = {'#414868', '#f7768e', '#9ece6a', '#e0af68', '#7aa2f7', '#bb9af7', '#7dcfff', '#c0caf5'}, +} +``` + +## Key Bindings + +### Custom Keybindings + +```lua +config.keys = { + -- Split panes + { key = 'd', mods = 'CMD', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } }, + { key = 'd', mods = 'CMD|SHIFT', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } }, + + -- Navigate panes + { key = 'LeftArrow', mods = 'CMD', action = wezterm.action.ActivatePaneDirection 'Left' }, + { key = 'RightArrow', mods = 'CMD', action = wezterm.action.ActivatePaneDirection 'Right' }, + { key = 'UpArrow', mods = 'CMD', action = wezterm.action.ActivatePaneDirection 'Up' }, + { key = 'DownArrow', mods = 'CMD', action = wezterm.action.ActivatePaneDirection 'Down' }, + + -- Tabs + { key = 't', mods = 'CMD', action = wezterm.action.SpawnTab 'CurrentPaneDomain' }, + { key = 'w', mods = 'CMD', action = wezterm.action.CloseCurrentPane { confirm = true } }, + + -- Font size + { key = '=', mods = 'CMD', action = wezterm.action.IncreaseFontSize }, + { key = '-', mods = 'CMD', action = wezterm.action.DecreaseFontSize }, + { key = '0', mods = 'CMD', action = wezterm.action.ResetFontSize }, +} +``` + +### Leader Key + +```lua +-- Define leader key (like tmux prefix) +config.leader = { key = 'a', mods = 'CMD', timeout_milliseconds = 1000 } + +config.keys = { + -- Leader + c = new tab + { key = 'c', mods = 'LEADER', action = wezterm.action.SpawnTab 'CurrentPaneDomain' }, + -- Leader + | = vertical split + { key = '|', mods = 'LEADER', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } }, + -- Leader + - = horizontal split + { key = '-', mods = 'LEADER', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } }, +} +``` + +## Advanced Features + +### Tab Bar Customization + +```lua +config.use_fancy_tab_bar = false +config.tab_bar_at_bottom = true +config.hide_tab_bar_if_only_one_tab = true + +-- Custom tab title +wezterm.on('format-tab-title', function(tab) + local title = tab.tab_title + if title and #title > 0 then + return title + end + return tab.active_pane.title +end) +``` + +### Startup Actions + +```lua +-- Start with specific layout +wezterm.on('gui-startup', function(cmd) + local tab, pane, window = mux.spawn_window(cmd or {}) + -- Split right + pane:split { direction = 'Right' } +end) +``` + +### SSH Domains + +```lua +config.ssh_domains = { + { + name = 'my-server', + remote_address = 'server.example.com', + username = 'user', + }, +} + +-- Connect with: wezterm connect my-server +``` + +### Multiplexer + +```lua +-- Unix domain for persistent sessions +config.unix_domains = { + { name = 'unix' }, +} + +-- Default to multiplexer +config.default_gui_startup_args = { 'connect', 'unix' } +``` + +## Useful Snippets + +### Quick Theme Toggle + +```lua +local function toggle_theme() + local overrides = window:get_config_overrides() or {} + if overrides.color_scheme == 'Catppuccin Latte' then + overrides.color_scheme = 'Catppuccin Mocha' + else + overrides.color_scheme = 'Catppuccin Latte' + end + window:set_config_overrides(overrides) +end + +config.keys = { + { key = 't', mods = 'CMD|SHIFT', action = wezterm.action_callback(toggle_theme) }, +} +``` + +### Background Image + +```lua +config.window_background_image = '/path/to/image.png' +config.window_background_image_hsb = { + brightness = 0.02, + saturation = 0.5, +} +``` + +### Status Bar + +```lua +wezterm.on('update-right-status', function(window, pane) + window:set_right_status(wezterm.format({ + { Text = wezterm.strftime('%H:%M') }, + })) +end) +``` + +## Command Line + +```bash +# Open with specific config +wezterm --config-file path/to/config.lua + +# Connect to multiplexer +wezterm connect unix + +# List color schemes +wezterm ls-colors + +# Show key bindings +wezterm show-keys +wezterm show-keys --lua + +# CLI utilities +wezterm cli list # List panes +wezterm cli spawn # Spawn new pane +wezterm cli split-pane # Split current pane +``` + +## Best Practices + +1. **Start simple** - Add features as needed +2. **Use config_builder** - Better error messages +3. **Test incrementally** - WezTerm reloads on save +4. **Backup your config** - Keep in dotfiles repo +5. **Use leader keys** - Avoid conflicts with apps +6. **Check logs** - `wezterm --config-file ~/.wezterm.lua` shows errors diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a75a30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +package.json +package-lock.json +skills-lock.json +.current-theme \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f2384b --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +# WezTerm · Configuración con temas visuales + +Configuración de [WezTerm](https://wezterm.org) orientada a una estética de terminal de **sysadmin / developer / hacker**, con múltiples temas intercambiables en caliente. + +## Instalación + +El directorio de configuración de WezTerm es `~/.config/wezterm/`. Puedes copiar los archivos directamente o enlazarlos desde este repositorio: + +```bash +# Opción 1: copiar +cp -r wezterm.lua themes ~/.config/wezterm/ + +# Opción 2: enlace simbólico (mantiene el repo como fuente de verdad) +ln -s "$(pwd)" ~/.config/wezterm +``` + +Recarga la configuración dentro de WezTerm con `CTRL+SHIFT+R`. + +## Temas + +| Tema | Estética | Fondo | Acento | +|------|----------|-------|--------| +| `matrix` | Hacker · verde neón sobre negro | `#000000` | `#00ff41` | +| `phosphor-green` | Retro · fósforo verde VT100 | `#001a00` | `#33ff33` | +| `phosphor-amber` | Retro · fósforo ámbar VT100 | `#1a0f00` | `#ffb000` | +| `cyberpunk` | Neon · magenta/cian sobre púrpura | `#0d0221` | `#ff2a6d` | +| `nord` | Sysadmin · azul-gris sobrio | `#2e3440` | `#81a1c1` | +| `tokyonight` | Developer · azul oscuro | `#1a1b26` | `#7aa2f7` | +| `dracula` | Developer · púrpura oscuro | `#282a36` | `#bd93f9` | + +## Atajos + +| Atajo | Acción | +|-------|--------| +| `CTRL+SHIFT+H` | Ciclar al siguiente tema (con notificación) | +| `CTRL+SHIFT+R` | Recargar configuración | + +La selección de tema se persiste en `.current-theme` (no versionado): al abrir WezTerm arranca con el último tema elegido. Sin ese archivo, el tema por defecto es `matrix`. + +## Dividir panes y moverse + +| Atajo | Acción | +|-------|--------| +| `CTRL+SHIFT+ALT+"` | Dividir verticalmente (pane arriba/abajo) | +| `CTRL+SHIFT+ALT+%` | Dividir horizontalmente (pane izquierda/derecha) | +| `CTRL+SHIFT+←/→/↑/↓` | Moverse entre panes | +| `CTRL+SHIFT+ALT+←/→/↑/↓` | Redimensionar el pane activo | +| `CTRL+SHIFT+Z` | Zoom sobre el pane activo (maximizar) | +| `CTRL+SHIFT+W` | Cerrar pane/pestaña (con confirmación) | +| `CTRL+SHIFT+T` | Nueva pestaña | + +Son los atajos por defecto de WezTerm (verificados con `wezterm show-keys`), así que funcionan sin configuración adicional. + +## Personalización asistida + +Este repositorio incluye la skill `wezterm` (`.agents/skills/wezterm/SKILL.md`): una guía para configurar y personalizar WezTerm — fuentes, colores, keybindings, tab bar, leader key, dominios SSH, multiplexor y más. Úsala como referencia para ampliar esta configuración o construir nuevas funciones. + +## Estructura + +``` +wezterm.lua # Configuración principal: fuentes, tab bar, status bar, atajos +themes/ +├── registry.lua # Registro, ciclado y persistencia de temas +├── matrix.lua # Un archivo por tema (paleta ansi/brights/tab_bar completa) +├── phosphor-green.lua +├── phosphor-amber.lua +├── cyberpunk.lua +├── nord.lua +├── tokyonight.lua +└── dracula.lua +``` + +Cada tema es autocontenido: define su propia paleta de colores (`foreground`, `background`, cursor, selección, `ansi[8]`, `brights[8]`, tab bar), opacidad, gradiente de fondo y parpadeo del cursor, por lo que no depende de esquemas externos. + +## Añadir un tema nuevo + +1. Crea un archivo en `themes/` siguiendo el mismo formato que los existentes (tabla con `name`, `label`, `colors` y ajustes opcionales). +2. Regístralo en `themes/registry.lua` dentro de la lista `theme_files`. +3. Recarga con `CTRL+SHIFT+R` y cíclalo con `CTRL+SHIFT+H`. + +## Requisitos + +- WezTerm 20240203 o superior +- Fuente `JetBrains Mono` (con `Nerd Font Symbols` como fallback) \ No newline at end of file diff --git a/themes/cyberpunk.lua b/themes/cyberpunk.lua new file mode 100644 index 0000000..0c493ff --- /dev/null +++ b/themes/cyberpunk.lua @@ -0,0 +1,47 @@ +local colors = { + foreground = '#d0e8ff', + background = '#0d0221', + cursor_bg = '#05d9e8', + cursor_fg = '#0d0221', + cursor_border = '#05d9e8', + selection_bg = '#3d1256', + selection_fg = '#ffffff', + compose_cursor = '#05d9e8', + ansi = { + '#0d0221', + '#ff2a6d', + '#05d9e8', + '#f2f230', + '#00b3ff', + '#b967ff', + '#01c4e7', + '#d0e8ff', + }, + brights = { + '#3d1256', + '#ff5c8a', + '#6ffff0', + '#ffff6a', + '#5cc9ff', + '#d08cff', + '#7ce9ff', + '#ffffff', + }, + tab_bar = { + background = '#16052e', + active_tab = { bg_color = '#ff2a6d', fg_color = '#ffffff', intensity = 'Bold' }, + inactive_tab = { bg_color = '#16052e', fg_color = '#05d9e8' }, + inactive_tab_hover = { bg_color = '#3d1256', fg_color = '#ff5c8a' }, + new_tab = { bg_color = '#16052e', fg_color = '#05d9e8' }, + new_tab_hover = { bg_color = '#3d1256', fg_color = '#b967ff' }, + }, +} + +return { + name = 'cyberpunk', + label = 'CYBERPUNK', + colors = colors, + window_background_opacity = 0.97, + window_background_gradient = { colors = { '#0d0221', '#1a0533' }, orientation = 'Vertical' }, + cursor_blink_rate = 500, +} \ No newline at end of file diff --git a/themes/dracula.lua b/themes/dracula.lua new file mode 100644 index 0000000..81e4896 --- /dev/null +++ b/themes/dracula.lua @@ -0,0 +1,46 @@ +local colors = { + foreground = '#f8f8f2', + background = '#282a36', + cursor_bg = '#f8f8f2', + cursor_fg = '#282a36', + cursor_border = '#f8f8f2', + selection_bg = '#44475a', + selection_fg = '#f8f8f2', + compose_cursor = '#f8f8f2', + ansi = { + '#21222c', + '#ff5555', + '#50fa7b', + '#f1fa8c', + '#bd93f9', + '#ff79c6', + '#8be9fd', + '#f8f8f2', + }, + brights = { + '#6272a4', + '#ff6e6e', + '#69ff94', + '#ffffa5', + '#d6acff', + '#ff92df', + '#a4ffff', + '#ffffff', + }, + tab_bar = { + background = '#21222c', + active_tab = { bg_color = '#bd93f9', fg_color = '#282a36', intensity = 'Bold' }, + inactive_tab = { bg_color = '#21222c', fg_color = '#f8f8f2' }, + inactive_tab_hover = { bg_color = '#44475a', fg_color = '#f8f8f2' }, + new_tab = { bg_color = '#21222c', fg_color = '#50fa7b' }, + new_tab_hover = { bg_color = '#44475a', fg_color = '#f8f8f2' }, + }, +} + +return { + name = 'dracula', + label = 'DRACULA', + colors = colors, + window_background_opacity = 1.0, + cursor_blink_rate = 500, +} \ No newline at end of file diff --git a/themes/matrix.lua b/themes/matrix.lua new file mode 100644 index 0000000..49ecd0e --- /dev/null +++ b/themes/matrix.lua @@ -0,0 +1,47 @@ +local colors = { + foreground = '#00ff41', + background = '#000000', + cursor_bg = '#00ff41', + cursor_fg = '#000000', + cursor_border = '#00ff41', + selection_bg = '#003b1f', + selection_fg = '#c8ffe0', + compose_cursor = '#00ff41', + ansi = { + '#0a1f0a', + '#ff4d4d', + '#00ff41', + '#c8e65c', + '#40c9ff', + '#c792ea', + '#00e0a0', + '#a8ffb0', + }, + brights = { + '#1a3b1a', + '#ff8080', + '#66ff8a', + '#e0ff70', + '#80ddff', + '#d4a0ff', + '#66ffc0', + '#d8ffdd', + }, + tab_bar = { + background = '#001400', + active_tab = { bg_color = '#00ff41', fg_color = '#000000', intensity = 'Bold' }, + inactive_tab = { bg_color = '#001400', fg_color = '#00ff41' }, + inactive_tab_hover = { bg_color = '#003b1f', fg_color = '#00ff41' }, + new_tab = { bg_color = '#001400', fg_color = '#00ff41' }, + new_tab_hover = { bg_color = '#003b1f', fg_color = '#00ff41' }, + }, +} + +return { + name = 'matrix', + label = 'MATRIX', + colors = colors, + window_background_opacity = 0.97, + window_background_gradient = { colors = { '#000000', '#001a00' }, orientation = 'Vertical' }, + cursor_blink_rate = 500, +} \ No newline at end of file diff --git a/themes/nord.lua b/themes/nord.lua new file mode 100644 index 0000000..8ef981d --- /dev/null +++ b/themes/nord.lua @@ -0,0 +1,46 @@ +local colors = { + foreground = '#d8dee9', + background = '#2e3440', + cursor_bg = '#d8dee9', + cursor_fg = '#2e3440', + cursor_border = '#d8dee9', + selection_bg = '#4c566a', + selection_fg = '#eceff4', + compose_cursor = '#d8dee9', + ansi = { + '#3b4252', + '#bf616a', + '#a3be8c', + '#ebcb8b', + '#81a1c1', + '#b48ead', + '#88c0d0', + '#e5e9f0', + }, + brights = { + '#4c566a', + '#bf616a', + '#a3be8c', + '#ebcb8b', + '#81a1c1', + '#b48ead', + '#8fbcbb', + '#eceff4', + }, + tab_bar = { + background = '#2e3440', + active_tab = { bg_color = '#81a1c1', fg_color = '#2e3440', intensity = 'Bold' }, + inactive_tab = { bg_color = '#3b4252', fg_color = '#d8dee9' }, + inactive_tab_hover = { bg_color = '#434c5e', fg_color = '#eceff4' }, + new_tab = { bg_color = '#3b4252', fg_color = '#88c0d0' }, + new_tab_hover = { bg_color = '#434c5e', fg_color = '#eceff4' }, + }, +} + +return { + name = 'nord', + label = 'NORD', + colors = colors, + window_background_opacity = 1.0, + cursor_blink_rate = 500, +} \ No newline at end of file diff --git a/themes/phosphor-amber.lua b/themes/phosphor-amber.lua new file mode 100644 index 0000000..44f843a --- /dev/null +++ b/themes/phosphor-amber.lua @@ -0,0 +1,47 @@ +local colors = { + foreground = '#ffb000', + background = '#1a0f00', + cursor_bg = '#ffb000', + cursor_fg = '#1a0f00', + cursor_border = '#ffb000', + selection_bg = '#4a2c00', + selection_fg = '#ffe8c0', + compose_cursor = '#ffb000', + ansi = { + '#1a0f00', + '#ff4a00', + '#ffb000', + '#ffd080', + '#ff8c00', + '#ff6600', + '#ffcc66', + '#ffd9a0', + }, + brights = { + '#3d2a00', + '#ff6a00', + '#ffc040', + '#ffe0a0', + '#ffaa40', + '#ff8040', + '#ffd080', + '#ffe8c0', + }, + tab_bar = { + background = '#241500', + active_tab = { bg_color = '#ffb000', fg_color = '#1a0f00', intensity = 'Bold' }, + inactive_tab = { bg_color = '#241500', fg_color = '#ffb000' }, + inactive_tab_hover = { bg_color = '#4a2c00', fg_color = '#ffb000' }, + new_tab = { bg_color = '#241500', fg_color = '#ffb000' }, + new_tab_hover = { bg_color = '#4a2c00', fg_color = '#ffb000' }, + }, +} + +return { + name = 'phosphor-amber', + label = 'PHOSPHOR-AMBER', + colors = colors, + window_background_opacity = 0.97, + window_background_gradient = { colors = { '#1a0f00', '#2a1a00' }, orientation = 'Vertical' }, + cursor_blink_rate = 600, +} \ No newline at end of file diff --git a/themes/phosphor-green.lua b/themes/phosphor-green.lua new file mode 100644 index 0000000..44fb671 --- /dev/null +++ b/themes/phosphor-green.lua @@ -0,0 +1,47 @@ +local colors = { + foreground = '#33ff33', + background = '#001a00', + cursor_bg = '#33ff33', + cursor_fg = '#001a00', + cursor_border = '#33ff33', + selection_bg = '#003d00', + selection_fg = '#ccffcc', + compose_cursor = '#33ff33', + ansi = { + '#003300', + '#00cc44', + '#33ff33', + '#99ff33', + '#00ccff', + '#66ffcc', + '#00ff88', + '#ccffcc', + }, + brights = { + '#006600', + '#33ff66', + '#66ff66', + '#ccff66', + '#66ffff', + '#99ffee', + '#66ffcc', + '#ffffff', + }, + tab_bar = { + background = '#002000', + active_tab = { bg_color = '#33ff33', fg_color = '#001a00', intensity = 'Bold' }, + inactive_tab = { bg_color = '#002000', fg_color = '#33ff33' }, + inactive_tab_hover = { bg_color = '#003d00', fg_color = '#33ff33' }, + new_tab = { bg_color = '#002000', fg_color = '#33ff33' }, + new_tab_hover = { bg_color = '#003d00', fg_color = '#33ff33' }, + }, +} + +return { + name = 'phosphor-green', + label = 'PHOSPHOR-GREEN', + colors = colors, + window_background_opacity = 0.97, + window_background_gradient = { colors = { '#001a00', '#002000' }, orientation = 'Vertical' }, + cursor_blink_rate = 600, +} \ No newline at end of file diff --git a/themes/registry.lua b/themes/registry.lua new file mode 100644 index 0000000..b512441 --- /dev/null +++ b/themes/registry.lua @@ -0,0 +1,71 @@ +local wezterm = require 'wezterm' + +local themes_dir = wezterm.config_dir .. '/themes' +local state_file = wezterm.config_dir .. '/.current-theme' + +local theme_files = { + 'matrix', + 'phosphor-green', + 'phosphor-amber', + 'cyberpunk', + 'nord', + 'tokyonight', + 'dracula', +} + +local themes = {} +local order = {} + +for _, name in ipairs(theme_files) do + local ok, theme = pcall(dofile, themes_dir .. '/' .. name .. '.lua') + if ok and theme and theme.name then + themes[name] = theme + order[#order + 1] = name + else + wezterm.log_error('wezterm-themes: error loading theme "' .. name .. '": ' .. tostring(theme)) + end +end + +local M = {} + +function M.names() + return order +end + +function M.get(name) + return themes[name] or themes[order[1]] +end + +function M.current() + local f = io.open(state_file, 'r') + local name = f and f:read('*l') + if f then + f:close() + end + if name and themes[name] then + return themes[name] + end + return themes[order[1]] +end + +function M.next(name) + local cur = name or M.current().name + local idx = 0 + for i, n in ipairs(order) do + if n == cur then + idx = i + break + end + end + return themes[order[(idx % #order) + 1]] +end + +function M.save(theme) + local f = io.open(state_file, 'w') + if f then + f:write(theme.name .. '\n') + f:close() + end +end + +return M \ No newline at end of file diff --git a/themes/tokyonight.lua b/themes/tokyonight.lua new file mode 100644 index 0000000..7972866 --- /dev/null +++ b/themes/tokyonight.lua @@ -0,0 +1,46 @@ +local colors = { + foreground = '#c0caf5', + background = '#1a1b26', + cursor_bg = '#c0caf5', + cursor_fg = '#1a1b26', + cursor_border = '#c0caf5', + selection_bg = '#33467c', + selection_fg = '#c0caf5', + compose_cursor = '#c0caf5', + ansi = { + '#15161e', + '#f7768e', + '#9ece6a', + '#e0af68', + '#7aa2f7', + '#bb9af7', + '#7dcfff', + '#a9b1d6', + }, + brights = { + '#414868', + '#f7768e', + '#9ece6a', + '#e0af68', + '#7aa2f7', + '#bb9af7', + '#7dcfff', + '#c0caf5', + }, + tab_bar = { + background = '#16161e', + active_tab = { bg_color = '#7aa2f7', fg_color = '#16161e', intensity = 'Bold' }, + inactive_tab = { bg_color = '#16161e', fg_color = '#a9b1d6' }, + inactive_tab_hover = { bg_color = '#1f2335', fg_color = '#c0caf5' }, + new_tab = { bg_color = '#16161e', fg_color = '#7aa2f7' }, + new_tab_hover = { bg_color = '#1f2335', fg_color = '#7dcfff' }, + }, +} + +return { + name = 'tokyonight', + label = 'TOKYO-NIGHT', + colors = colors, + window_background_opacity = 1.0, + cursor_blink_rate = 500, +} \ No newline at end of file diff --git a/wezterm.lua b/wezterm.lua new file mode 100644 index 0000000..2fd87a8 --- /dev/null +++ b/wezterm.lua @@ -0,0 +1,89 @@ +local wezterm = require 'wezterm' +local config = wezterm.config_builder() + +local registry = dofile(wezterm.config_dir .. '/themes/registry.lua') + +-- Fields that can vary between themes and must be hot-swappable. +local THEME_FIELDS = { + 'colors', + 'window_background_opacity', + 'window_background_gradient', + 'cursor_blink_rate', +} + +local function apply_theme(cfg, theme) + for _, field in ipairs(THEME_FIELDS) do + if theme[field] ~= nil then + cfg[field] = theme[field] + end + end +end + +apply_theme(config, registry.current()) + +-- Font +config.font = wezterm.font_with_fallback({ + 'JetBrains Mono', + 'Nerd Font Symbols', +}) +config.font_size = 14.0 + +-- Window +config.window_padding = { left = 10, right = 10, top = 10, bottom = 10 } +config.window_close_confirmation = 'AlwaysPrompt' +config.scrollback_lines = 10000 + +-- Tab bar +config.enable_tab_bar = true +config.use_fancy_tab_bar = false +config.tab_bar_at_bottom = false +config.hide_tab_bar_if_only_one_tab = false +config.show_tab_index_in_tab_bar = true + +-- Keybindings +local act = wezterm.action + +config.keys = { + { + key = 'h', + mods = 'CTRL|SHIFT', + action = wezterm.action_callback(function(window, pane) + local next_theme = registry.next() + registry.save(next_theme) + + local overrides = {} + for _, field in ipairs(THEME_FIELDS) do + if next_theme[field] ~= nil then + overrides[field] = next_theme[field] + end + end + window:set_config_overrides(overrides) + + window:toast_notification('Tema', next_theme.label, nil, 1500) + window:perform_action(act.EmitEvent('update-right-status'), pane) + end), + }, +} + +-- Status bar +wezterm.on('update-right-status', function(window, _) + local theme = registry.current() + window:set_right_status(wezterm.format({ + { Text = ' ' }, + { Foreground = { Color = theme.colors.cursor_bg } }, + { Text = '> ' }, + { Foreground = { Color = theme.colors.ansi[4] } }, + { Attribute = { Intensity = 'Bold' } }, + { Text = theme.label }, + { Attribute = { Intensity = 'Normal' } }, + { Text = ' ' }, + { Foreground = { Color = theme.colors.ansi[2] } }, + { Text = wezterm.hostname() }, + { Text = ' ' }, + { Foreground = { Color = theme.colors.ansi[3] } }, + { Text = wezterm.strftime('%H:%M') }, + { Text = ' ' }, + })) +end) + +return config \ No newline at end of file