From 555427d77d0b49c3d60d9ae0f43133e0e7dce957 Mon Sep 17 00:00:00 2001 From: Hexin Date: Tue, 8 Oct 2024 08:11:44 +0900 Subject: [PATCH] Add wezterm config --- config/lsyncd/wsl.lua | 5 +++++ config/wezterm/appearance.lua | 38 +++++++++++++++++++++++++++++++++++ config/wezterm/keys.lua | 22 ++++++++++++++++++++ config/wezterm/wezterm.lua | 28 ++++++++++++++++++++++++++ install | 1 + 5 files changed, 94 insertions(+) create mode 100644 config/wezterm/appearance.lua create mode 100644 config/wezterm/keys.lua create mode 100644 config/wezterm/wezterm.lua diff --git a/config/lsyncd/wsl.lua b/config/lsyncd/wsl.lua index 1dfb130..b19b566 100644 --- a/config/lsyncd/wsl.lua +++ b/config/lsyncd/wsl.lua @@ -1,4 +1,5 @@ local xdg_config_home = os.getenv('XDG_CONFIG_HOME') or '/home/hexin/.config' +local user_profile = os.getenv('USERPROFILE') or '/mnt/c/Users/Hexin' local appdata = os.getenv('APPDATA') or '/mnt/c/Users/Hexin/AppData/Roaming' local transitions = { @@ -6,6 +7,10 @@ local transitions = { source = ('%s/alacritty/'):format(xdg_config_home), target = ('%s/alacritty/'):format(appdata), }, + { + source = ('%s/wezterm/'):format(xdg_config_home), + target = ('%s/.config/wezterm/'):format(user_profile), + }, } for _, transition in ipairs(transitions) do diff --git a/config/wezterm/appearance.lua b/config/wezterm/appearance.lua new file mode 100644 index 0000000..0e9c7ec --- /dev/null +++ b/config/wezterm/appearance.lua @@ -0,0 +1,38 @@ +local wezterm = require('wezterm') + +local M = {} + +function M.apply(config) + config.initial_rows = 46 + config.initial_cols = 160 + + config.color_scheme = 'Tomorrow Night Eighties' + + config.font = wezterm.font('HackGen Console NF') + config.font_size = 11 + + config.enable_tab_bar = false + + config.animation_fps = 1 + config.cursor_blink_ease_in = 'Constant' + config.cursor_blink_ease_out = 'Constant' + + config.ui_key_cap_rendering = 'WindowsSymbols' + + config.window_decorations = 'RESIZE' + config.window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0, + } + + wezterm.on('gui-startup', function (cmd) + local _, _, window = wezterm.mux.spawn_window(cmd or {}) + + local gui_window = window:gui_window() + gui_window:set_position(0, 0) + end) +end + +return M diff --git a/config/wezterm/keys.lua b/config/wezterm/keys.lua new file mode 100644 index 0000000..d4a949b --- /dev/null +++ b/config/wezterm/keys.lua @@ -0,0 +1,22 @@ +local wezterm = require('wezterm') + +local M = {} + +function M.apply(config) + config.keys = { + { + key = 'k', + mods = 'CTRL | SHIFT', + action = wezterm.action.ShowDebugOverlay, + }, + { + key = '^', + mods = 'CTRL', + action = wezterm.action.DisableDefaultAssignment, + }, + } +config.debug_key_events = true +end + + +return M diff --git a/config/wezterm/wezterm.lua b/config/wezterm/wezterm.lua new file mode 100644 index 0000000..01ef11f --- /dev/null +++ b/config/wezterm/wezterm.lua @@ -0,0 +1,28 @@ +local wezterm = require('wezterm') +local appearance = require('appearance') +local keys = require('keys') + +local config = wezterm.config_builder() + +config.automatically_reload_config = true + +config.font = wezterm.font('HackGen Console NF') +config.font_size = 11 +config.check_for_updates = true + +config.default_prog = { + 'C:/Windows/system32/wsl.exe', + '--cd', + '~', + '--distribution', + 'arch', + '--exec', + '/bin/zsh', + '-c', + 'tmux new -A && exec zsh -i', +} + +appearance.apply(config) +keys.apply(config) + +return config diff --git a/install b/install index aa0c624..0933439 100755 --- a/install +++ b/install @@ -57,6 +57,7 @@ install_dotfiels() { make_symlink tmux $XDG_CONFIG_HOME/tmux make_symlink npm $XDG_CONFIG_HOME/npm make_symlink alacritty $XDG_CONFIG_HOME/alacritty + make_symlink wezterm $XDG_CONFIG_HOME/wezterm make_symlink lsyncd $XDG_CONFIG_HOME/lsyncd make_symlink systemd/user $XDG_CONFIG_HOME/systemd/user }