From f8914b61d5886e3bbe24db1b3408dd8c964f21a3 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 4 Feb 2025 10:14:48 -0600 Subject: [PATCH] Wezterm config outofstore --- modules/home-manager/default.nix | 79 +-------- modules/home-manager/niri/config.kdl | 8 +- .../colors/catppuccin-mocha-sapphire.toml | 40 +++++ modules/home-manager/wezterm/config.lua | 154 ---------------- modules/home-manager/wezterm/wezterm.lua | 166 ++++++++++++++++++ 5 files changed, 218 insertions(+), 229 deletions(-) create mode 100644 modules/home-manager/wezterm/colors/catppuccin-mocha-sapphire.toml delete mode 100644 modules/home-manager/wezterm/config.lua create mode 100644 modules/home-manager/wezterm/wezterm.lua diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index d9d7c23..ea52864 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1410,79 +1410,15 @@ wezterm = { pkgs, - # font, + config, ... }: { - # docs: https://wezfurlong.org/wezterm/config/appearance.html#defining-your-own-colors - programs.wezterm = with style.colors.withHashPrefix; { - enable = true; - # package = pkgs.wezterm; - extraConfig = builtins.readFile ./wezterm/config.lua; - colorSchemes = { - catppuccin-mocha-sapphire = { - ansi = map (x: style.colors.withHashPrefix.${toString x}) (pkgs.lib.lists.range 0 7); - brights = map (x: style.colors.withHashPrefix.${toString (x + 8)}) (pkgs.lib.lists.range 0 7); + home.packages = with pkgs; [ + wezterm + ]; - foreground = fg; - background = bg; - - cursor_fg = bg; - cursor_bg = text; - cursor_border = text; - - selection_fg = bg; - selection_bg = yellow; - - scrollbar_thumb = bg2; - - split = bg5; - - # indexed = { [136] = '#af8700' }, - tab_bar = { - background = bg3; - - active_tab = { - bg_color = primary; - fg_color = bg; - italic = false; - }; - inactive_tab = { - bg_color = bg2; - fg_color = fgdim; - italic = false; - }; - inactive_tab_hover = { - bg_color = bg3; - fg_color = primary; - italic = false; - }; - new_tab = { - bg_color = bg2; - fg_color = fgdim; - italic = false; - }; - new_tab_hover = { - bg_color = bg3; - fg_color = primary; - italic = false; - }; - }; - - compose_cursor = orange; - - /* - copy_mode_active_highlight_bg = { Color = '#000000' }, - copy_mode_active_highlight_fg = { AnsiColor = 'Black' }, - copy_mode_inactive_highlight_bg = { Color = '#52ad70' }, - copy_mode_inactive_highlight_fg = { AnsiColor = 'White' }, - - quick_select_label_bg = { Color = 'peru' }, - quick_select_label_fg = { Color = '#ffffff' }, - quick_select_match_bg = { AnsiColor = 'Navy' }, - quick_select_match_fg = { Color = '#ffffff' }, - */ - }; - }; + home.file."${config.xdg.configHome}/wezterm" = { + source = config.lib.file.mkOutOfStoreSymlink /etc/nix/flake/modules/home-manager/wezterm; }; }; @@ -1490,10 +1426,11 @@ # zellij does not support modern terminal keyboard input: # https://github.com/zellij-org/zellij/issues/735 programs.zellij = { - # uses home manager's toKDL generator enable = true; # This causes fish to start zellij immediately # enableFishIntegration = true; + + # uses home manager's toKDL generator settings = { pane_frames = false; simplified_ui = true; diff --git a/modules/home-manager/niri/config.kdl b/modules/home-manager/niri/config.kdl index cb43633..349a923 100644 --- a/modules/home-manager/niri/config.kdl +++ b/modules/home-manager/niri/config.kdl @@ -111,7 +111,7 @@ layout { // - "always", the focused column will always be centered. // - "on-overflow", focusing a column will center it if it doesn't fit // together with the previously focused column. - center-focused-column "never" + center-focused-column "always" // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between. preset-column-widths { @@ -130,7 +130,7 @@ layout { // preset-window-heights { } // You can change the default width of the new windows. - default-column-width { proportion 0.5; } + // default-column-width { proportion 0.5; } // If you leave the brackets empty, the windows themselves will decide their initial width. // default-column-width {} @@ -302,8 +302,8 @@ binds { // Example volume keys mappings for PipeWire & WirePlumber. // The allow-when-locked=true property makes them work even when the session is locked. - XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; } - XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; } + XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05+"; } + XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05-"; } XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; } diff --git a/modules/home-manager/wezterm/colors/catppuccin-mocha-sapphire.toml b/modules/home-manager/wezterm/colors/catppuccin-mocha-sapphire.toml new file mode 100644 index 0000000..ee3c5a1 --- /dev/null +++ b/modules/home-manager/wezterm/colors/catppuccin-mocha-sapphire.toml @@ -0,0 +1,40 @@ +[colors] +ansi = ["#45475a", "#f38ba8", "#a6e3a1", "#fab387", "#74c7ec", "#cba6f7", "#f9e2af", "#bac2de"] +background = "#1e1e2e" +brights = ["#585b70", "#f38ba8", "#a6e3a1", "#fab387", "#74c7ec", "#cba6f7", "#f9e2af", "#a6adc8"] +compose_cursor = "#fab387" +cursor_bg = "#cdd6f4" +cursor_border = "#cdd6f4" +cursor_fg = "#1e1e2e" +foreground = "#cdd6f4" +scrollbar_thumb = "#181825" +selection_bg = "#f9e2af" +selection_fg = "#1e1e2e" +split = "#585b70" + +[colors.tab_bar] +background = "#313244" +[colors.tab_bar.active_tab] +bg_color = "#74c7ec" +fg_color = "#1e1e2e" +italic = false + +[colors.tab_bar.inactive_tab] +bg_color = "#181825" +fg_color = "#6c7086" +italic = false + +[colors.tab_bar.inactive_tab_hover] +bg_color = "#313244" +fg_color = "#74c7ec" +italic = false + +[colors.tab_bar.new_tab] +bg_color = "#181825" +fg_color = "#6c7086" +italic = false + +[colors.tab_bar.new_tab_hover] +bg_color = "#313244" +fg_color = "#74c7ec" +italic = false diff --git a/modules/home-manager/wezterm/config.lua b/modules/home-manager/wezterm/config.lua deleted file mode 100644 index 677214f..0000000 --- a/modules/home-manager/wezterm/config.lua +++ /dev/null @@ -1,154 +0,0 @@ -local wezterm = require 'wezterm' -local config = {} -if wezterm.config_builder then - config = wezterm.config_builder() -end - -config.adjust_window_size_when_changing_font_size = false -config.font = wezterm.font_with_fallback { - { family = "IosevkaLyteTerm", weight = 'Medium', italic = false }, - { family = 'Symbols Nerd Font Mono', weight = 'Regular', italic = false }, - 'Noto Color Emoji', -} -config.font_size = 12.0 --- config.window_frame.font = config.font --- config.window_frame.font_size = font_size - -config.default_cursor_style = 'BlinkingBar' --- config.disable_default_key_bindings = true -config.hide_tab_bar_if_only_one_tab = true -config.use_fancy_tab_bar = false -config.tab_bar_at_bottom = true -config.window_background_opacity = 1.0 -config.enable_kitty_keyboard = true -config.show_new_tab_button_in_tab_bar = true -config.notification_handling = "SuppressFromFocusedTab" - --- config.front_end = "WebGpu" --- config.webgpu_power_preference = 'HighPerformance' -config.enable_wayland = true --- config.use_ime = true - -local function tab_title(tab_info) - local title = tab_info.tab_title - if title and #title > 0 then - return title - end - return tab_info.active_pane.title -end - --- wezterm.on('format-tab-title', function (tab, tabs, panes, config, hover, max_width) -wezterm.on('format-tab-title', function(tab, _, _, _, _, max_width) - local title = tab_title(tab) - return ' ' .. string.sub(title, 0, max_width - 2) .. ' ' -end) - --- see nix module which has home manager create this color scheme file -config.color_scheme = 'catppuccin-mocha-sapphire'; - -config.inactive_pane_hsb = { - saturation = 0.8, - brightness = 0.7, -} - -config.keys = { - { - key = 'Insert', - mods = 'SHIFT', - action = wezterm.action.PasteFrom 'Clipboard' - }, - { - key = 'v', - mods = 'CTRL|SHIFT', - action = wezterm.action.PasteFrom 'PrimarySelection' - }, - { - key = 't', - mods = 'CTRL|SHIFT', - action = wezterm.action.SpawnTab 'CurrentPaneDomain' - }, - { - key = 'h', - mods = 'CTRL', - action = wezterm.action.ActivatePaneDirection 'Left' - }, - { - key = 'l', - mods = 'CTRL', - action = wezterm.action.ActivatePaneDirection 'Right' - }, - { - key = 'k', - mods = 'CTRL', - action = wezterm.action.ActivatePaneDirection 'Up' - }, - { - key = 'j', - mods = 'CTRL', - action = wezterm.action.ActivatePaneDirection 'Down' - }, - { - key = 'j', - mods = 'CTRL|SHIFT', - action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } - }, - { - key = 'l', - mods = 'CTRL|SHIFT', - action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } - }, - { - key = 'k', - mods = 'CTRL|SHIFT', - action = wezterm.action.SplitVertical { args = { 'top' }, domain = 'CurrentPaneDomain' } - }, - { - key = 'h', - mods = 'CTRL|SHIFT', - action = wezterm.action.SplitHorizontal { args = { 'right' }, domain = 'CurrentPaneDomain' } - }, - { - key = 'p', - mods = 'CTRL|SHIFT', - action = wezterm.action.ActivateCommandPalette - }, - { - key = 'w', - mods = 'CTRL|SHIFT', - action = wezterm.action.CloseCurrentPane { confirm = true }, - }, - { - key = 'w', - mods = 'CTRL|ALT|SHIFT', - action = wezterm.action.CloseCurrentTab { confirm = true }, - }, - { - key = 'l', - mods = 'CTRL|SHIFT|ALT', - action = wezterm.action.ShowDebugOverlay - }, - { - key = 'r', - mods = 'CTRL|SHIFT|ALT', - action = wezterm.action.RotatePanes 'Clockwise' - }, -} - --- config.unix_domains = { --- { --- name = 'unix', --- local_echo_threshold_ms = 10, --- }, --- } - --- config.default_gui_startup_args = { 'connect', 'unix' } --- config.default_domain = 'unix' - -config.window_padding = { - top = '0.5cell', - bottom = '0.5cell', - left = '1cell', - right = '1cell', -} - -return config diff --git a/modules/home-manager/wezterm/wezterm.lua b/modules/home-manager/wezterm/wezterm.lua new file mode 100644 index 0000000..2a6d59d --- /dev/null +++ b/modules/home-manager/wezterm/wezterm.lua @@ -0,0 +1,166 @@ +local wezterm = require 'wezterm' +local config = wezterm.config_builder() + +config.adjust_window_size_when_changing_font_size = false + +config.color_scheme = 'catppuccin-mocha-sapphire'; +config.font_size = 12.0 +config.font = wezterm.font_with_fallback { + { family = "IosevkaLyteTerm", weight = 'Medium', italic = false }, + { family = 'Symbols Nerd Font Mono', weight = 'Regular', italic = false }, + 'Noto Color Emoji', +} + +config.hide_tab_bar_if_only_one_tab = true +config.use_fancy_tab_bar = false +config.tab_bar_at_bottom = true +config.notification_handling = "SuppressFromFocusedTab" + +local a = wezterm.action +local s = { domain = 'CurrentPaneDomain' } +local st = { domain = 'CurrentPaneDomain', args={'top'} } +local sr = { domain = 'CurrentPaneDomain', args={'right'} } +config.keys = { + { key = 'j', mods = 'CTRL|SHIFT', action = a.SplitVertical(s) }, + { key = 'k', mods = 'CTRL|SHIFT', action = a.SplitVertical(st) }, + { key = 'l', mods = 'CTRL|SHIFT', action = a.SplitHorizontal(s) }, + { key = 'h', mods = 'CTRL|SHIFT', action = a.SplitHorizontal(sr) }, + { key = 'j', mods = 'CTRL', action = a.ActivatePaneDirection'Down' }, + { key = 'k', mods = 'CTRL', action = a.ActivatePaneDirection'Up' }, + { key = 'l', mods = 'CTRL', action = a.ActivatePaneDirection'Right' }, + { key = 'h', mods = 'CTRL', action = a.ActivatePaneDirection'Left' }, + { key = 'w', mods = 'CTRL', action = a.CloseCurrentPane{confirm=true} }, +} + +return config + +-- config.window_background_opacity = 1.0 +-- config.enable_kitty_keyboard = true +-- config.show_new_tab_button_in_tab_bar = true +-- config.notification_handling = "SuppressFromFocusedTab" + +-- config.front_end = "WebGpu" +-- config.webgpu_power_preference = 'HighPerformance' +-- config.enable_wayland = true +-- config.use_ime = true + +-- local function tab_title(tab_info) +-- local title = tab_info.tab_title +-- if title and #title > 0 then +-- return title +-- end +-- return tab_info.active_pane.title +-- end + +-- wezterm.on('format-tab-title', function (tab, tabs, panes, config, hover, max_width) +-- wezterm.on('format-tab-title', function(tab, _, _, _, _, max_width) +-- local title = tab_title(tab) +-- return ' ' .. string.sub(title, 0, max_width - 2) .. ' ' +-- end) + +-- see nix module which has home manager create this color scheme file + +-- config.inactive_pane_hsb = { +-- saturation = 0.8, +-- brightness = 0.7, +-- } + +-- config.keys = { +-- { +-- key = 'Insert', +-- mods = 'SHIFT', +-- action = wezterm.action.PasteFrom 'Clipboard' +-- }, +-- { +-- key = 'v', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.PasteFrom 'PrimarySelection' +-- }, +-- { +-- key = 't', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.SpawnTab 'CurrentPaneDomain' +-- }, +-- { +-- key = 'h', +-- mods = 'CTRL', +-- action = wezterm.action.ActivatePaneDirection 'Left' +-- }, +-- { +-- key = 'l', +-- mods = 'CTRL', +-- action = wezterm.action.ActivatePaneDirection 'Right' +-- }, +-- { +-- key = 'k', +-- mods = 'CTRL', +-- action = wezterm.action.ActivatePaneDirection 'Up' +-- }, +-- { +-- key = 'j', +-- mods = 'CTRL', +-- action = wezterm.action.ActivatePaneDirection 'Down' +-- }, +-- { +-- key = 'j', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } +-- }, +-- { +-- key = 'l', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } +-- }, +-- { +-- key = 'k', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.SplitVertical { args = { 'top' }, domain = 'CurrentPaneDomain' } +-- }, +-- { +-- key = 'h', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.SplitHorizontal { args = { 'right' }, domain = 'CurrentPaneDomain' } +-- }, +-- { +-- key = 'p', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.ActivateCommandPalette +-- }, +-- { +-- key = 'w', +-- mods = 'CTRL|SHIFT', +-- action = wezterm.action.CloseCurrentPane { confirm = true }, +-- }, +-- { +-- key = 'w', +-- mods = 'CTRL|ALT|SHIFT', +-- action = wezterm.action.CloseCurrentTab { confirm = true }, +-- }, +-- { +-- key = 'l', +-- mods = 'CTRL|SHIFT|ALT', +-- action = wezterm.action.ShowDebugOverlay +-- }, +-- { +-- key = 'r', +-- mods = 'CTRL|SHIFT|ALT', +-- action = wezterm.action.RotatePanes 'Clockwise' +-- }, +-- } + +-- config.unix_domains = { +-- { +-- name = 'unix', +-- local_echo_threshold_ms = 10, +-- }, +-- } + +-- config.default_gui_startup_args = { 'connect', 'unix' } +-- config.default_domain = 'unix' + +-- config.window_padding = { +-- top = '0.5cell', +-- bottom = '0.5cell', +-- left = '1cell', +-- right = '1cell', +-- }