wezterm: modularize events in apply config step

This commit is contained in:
Gabriel Arazas 2025-01-28 17:15:08 +08:00
parent 04e1a9d0b2
commit 0ee4d7df89
3 changed files with 41 additions and 34 deletions

View File

@ -3,6 +3,7 @@ local wezterm = require("wezterm")
local io = require("io") local io = require("io")
local os = require("os") local os = require("os")
function module.apply_to_config(config)
wezterm.on("update-right-status", function(window, _) wezterm.on("update-right-status", function(window, _)
local key = window:active_key_table() local key = window:active_key_table()
if key then if key then
@ -42,4 +43,11 @@ wezterm.on("view-last-output-in-new-pane", function(_, pane)
os.remove(tmpname) os.remove(tmpname)
end) end)
-- Maximize the terminal on startup.
wezterm.on('gui-startup', function(cmd)
local tab, pane, window = wezterm.mux.spawn_window(cmd or {})
window:gui_window():maximize()
end)
end
return module return module

View File

@ -2,9 +2,6 @@ local wezterm = require("wezterm")
local base = require("config/base") local base = require("config/base")
local act = wezterm.action local act = wezterm.action
-- Take note this is required to import the events in this module.
local _ = require("config/events")
local keymod = base.keymod local keymod = base.keymod
local alt_keymod = base.alt_keymod local alt_keymod = base.alt_keymod
local module = {} local module = {}

View File

@ -1,6 +1,8 @@
local config = require("wezterm").config_builder() local config = require("wezterm").config_builder()
config:set_strict_mode(true) config:set_strict_mode(true)
require("config/events").apply_to_config(config)
require("config/base").apply_to_config(config) require("config/base").apply_to_config(config)
require("config/keys").apply_to_config(config) require("config/keys").apply_to_config(config)
require("config/appearance").apply_to_config(config) require("config/appearance").apply_to_config(config)