From 54fa622c0b2d6c4f8cf7365952842f3d17861ac6 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Wed, 21 Aug 2024 13:39:57 +0200 Subject: [PATCH] wezterm --- home-manager/neovim.nix | 2 - home-manager/plasma.nix | 8 ++-- home-manager/terminal.nix | 27 ++---------- home-manager/tmux.nix | 6 --- home-manager/wezterm.lua | 92 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 36 deletions(-) create mode 100644 home-manager/wezterm.lua diff --git a/home-manager/neovim.nix b/home-manager/neovim.nix index 8abd153..5fa039f 100644 --- a/home-manager/neovim.nix +++ b/home-manager/neovim.nix @@ -5,7 +5,6 @@ enable = true; vimAlias = true; extraLuaConfig = '' - require('tmux').setup({ copy_sync = { redirect_to_clipboard = true } }); require('Comment').setup() require('nvim-surround').setup() require('numb').setup() @@ -174,7 +173,6 @@ comment-nvim vimtex gruvbox-nvim - tmux-nvim nvim-lspconfig idris2-vim numb-nvim diff --git a/home-manager/plasma.nix b/home-manager/plasma.nix index 4cbb6bf..8c4cc19 100644 --- a/home-manager/plasma.nix +++ b/home-manager/plasma.nix @@ -16,7 +16,7 @@ hotkeys.commands."launch-alacritty" = { name = "Launch alacritty"; key = "Meta+Return"; - command = "alacritty"; + command = "wezterm"; }; hotkeys.commands."cpypsk" = { @@ -49,7 +49,7 @@ config = { General.launchers = [ "applications:thunderbird.desktop" - "applications:Alacritty.desktop" + "applications:org.wezfurlong.wezterm.desktop" "applications:firefox.desktop" "applications:discord.desktop" ]; @@ -77,10 +77,10 @@ window-rules = [ { - description = "alacritty"; + description = "wezterm"; match = { window-class = { - value = "Alacritty"; + value = "wezterm"; type = "substring"; }; window-types = [ "normal" ]; diff --git a/home-manager/terminal.nix b/home-manager/terminal.nix index e98e759..ee42607 100644 --- a/home-manager/terminal.nix +++ b/home-manager/terminal.nix @@ -1,28 +1,7 @@ -{ extra, ... }: +{ ... }: { - programs.alacritty = { + programs.wezterm = { enable = true; - settings = { - window = { - padding.x = 5; - padding.y = 5; - decorations = "None"; - dynamic_title = false; - }; - mouse.hide_when_typing = true; - scrolling.history = 0; - font = { - normal.family = "SAX2 Nerd Font"; - size = 11; - }; - colors = { - draw_bold_text_with_bright_colors = false; - primary = { - background = "#1d1f21"; - foreground = "#c5c8c6"; - }; - }; - shell.program = extra.shell-menu; - }; + extraConfig = builtins.readFile ./wezterm.lua; }; } diff --git a/home-manager/tmux.nix b/home-manager/tmux.nix index 6eeecfa..c60634a 100644 --- a/home-manager/tmux.nix +++ b/home-manager/tmux.nix @@ -51,12 +51,6 @@ set-window-option -g window-status-separator "-" set-window-option -g window-status-current-format " #[fg=#b55690 bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! " set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} " - - set -g @resurrect-strategy-nvim 'session' - set -g @resurrect-capture-pane-contents 'on' ''; - plugins = with pkgs.tmuxPlugins; [ - resurrect - ]; }; } diff --git a/home-manager/wezterm.lua b/home-manager/wezterm.lua new file mode 100644 index 0000000..1a9eff6 --- /dev/null +++ b/home-manager/wezterm.lua @@ -0,0 +1,92 @@ +local wezterm = require 'wezterm' +local config = wezterm.config_builder() + +act = wezterm.action + +config.color_scheme = 'Gruvbox dark, hard (base16)' +config.use_fancy_tab_bar = false +config.hide_tab_bar_if_only_one_tab = true + +config.window_padding = { + left = 4, + right = 4, + top = 4, + bottom = 4, +} + +config.inactive_pane_hsb = { + saturation = 0.9, + brightness = 0.8, +} + +config.window_background_opacity = 0.95 +config.colors = { tab_bar = { background = 'rgba(29, 32, 33, 95%)' } } + + +font = wezterm.font_with_fallback { + 'SAX2 Nerd Font', + 'Fira Code', + 'Noto Mono', +} + +config.font = font + +config.font_rules = { + { + italic = true, + font = font, + } +} + +config.adjust_window_size_when_changing_font_size = false + +config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 700 } + +config.keys = { + { + key = 'a', + mods = 'LEADER|CTRL', + action = act.SendKey { key = 'a', mods = 'CTRL' }, + }, + { + key = 'c', + mods = 'LEADER', + action = act.SpawnTab "CurrentPaneDomain", + }, + { + key = 'n', + mods = 'LEADER', + action = act.ActivateTabRelative(1), + }, + { + key = 'p', + mods = 'LEADER', + action = act.ActivateTabRelative(-1), + }, +} + +for i = 1, 8 do + table.insert(config.keys, { + key = tostring(i), + mods = 'ALT', + action = act.ActivateTab(i - 1), + }) +end + +for key, dir in pairs({ h = 'Left', j = 'Down', k = 'Up', l = 'Right' }) do + table.insert(config.keys, { + key = key, + mods = 'ALT', + action = act.AdjustPaneSize { dir, 1 }, + }) + table.insert(config.keys, { + key = key, + mods = 'CTRL', + }) + table.insert(config.keys, { + key = key, + mods = 'LEADER', + }) +end + +return config