|
18 | 18 | # we can add wezterm as a flake input once this PR is merged:
|
19 | 19 | # https://github.com/wez/wezterm/pull/3547
|
20 | 20 |
|
21 |
| - programs.wezterm = |
22 |
| - { |
23 |
| - enable = false; # disable |
| 21 | + programs.wezterm = { |
| 22 | + enable = true; # disable |
24 | 23 |
|
25 |
| - # TODO: Fix: https://github.com/wez/wezterm/issues/4483 |
26 |
| - # package = pkgs.wezterm.override { }; |
| 24 | + # install wezterm via homebrew on macOS to avoid compilation, dummy package here. |
| 25 | + package = |
| 26 | + if pkgs.stdenv.isLinux |
| 27 | + then pkgs.wezterm |
| 28 | + else pkgs.hello; |
27 | 29 |
|
28 |
| - extraConfig = let |
29 |
| - fontsize = |
30 |
| - if pkgs.stdenv.isDarwin |
31 |
| - then "14.0" |
32 |
| - else "13.0"; |
33 |
| - in '' |
34 |
| - -- Pull in the wezterm API |
35 |
| - local wezterm = require 'wezterm' |
| 30 | + enableBashIntegration = pkgs.stdenv.isLinux; |
| 31 | + enableZshIntegration = pkgs.stdenv.isLinux; |
36 | 32 |
|
37 |
| - -- This table will hold the configuration. |
38 |
| - local config = {} |
| 33 | + extraConfig = let |
| 34 | + fontsize = |
| 35 | + if pkgs.stdenv.isLinux |
| 36 | + then "13.0" |
| 37 | + else "14.0"; |
| 38 | + in '' |
| 39 | + -- Pull in the wezterm API |
| 40 | + local wezterm = require 'wezterm' |
39 | 41 |
|
40 |
| - -- In newer versions of wezterm, use the config_builder which will |
41 |
| - -- help provide clearer error messages |
42 |
| - if wezterm.config_builder then |
43 |
| - config = wezterm.config_builder() |
44 |
| - end |
45 |
| -
|
46 |
| - wezterm.on('toggle-opacity', function(window, pane) |
47 |
| - local overrides = window:get_config_overrides() or {} |
48 |
| - if not overrides.window_background_opacity then |
49 |
| - overrides.window_background_opacity = 0.93 |
50 |
| - else |
51 |
| - overrides.window_background_opacity = nil |
52 |
| - end |
53 |
| - window:set_config_overrides(overrides) |
54 |
| - end) |
| 42 | + -- This table will hold the configuration. |
| 43 | + local config = {} |
55 | 44 |
|
56 |
| - wezterm.on('toggle-maximize', function(window, pane) |
57 |
| - window:maximize() |
58 |
| - end) |
| 45 | + -- In newer versions of wezterm, use the config_builder which will |
| 46 | + -- help provide clearer error messages |
| 47 | + if wezterm.config_builder then |
| 48 | + config = wezterm.config_builder() |
| 49 | + end |
59 | 50 |
|
60 |
| - -- This is where you actually apply your config choices |
61 |
| - config.color_scheme = "Catppuccin Mocha" |
62 |
| - config.font = wezterm.font_with_fallback { |
63 |
| - "JetBrainsMono Nerd Font", |
64 |
| - "FiraCode Nerd Font", |
| 51 | + wezterm.on('toggle-opacity', function(window, pane) |
| 52 | + local overrides = window:get_config_overrides() or {} |
| 53 | + if not overrides.window_background_opacity then |
| 54 | + overrides.window_background_opacity = 0.93 |
| 55 | + else |
| 56 | + overrides.window_background_opacity = nil |
| 57 | + end |
| 58 | + window:set_config_overrides(overrides) |
| 59 | + end) |
65 | 60 |
|
66 |
| - -- To avoid 'Chinese characters displayed as variant (Japanese) glyphs' |
67 |
| - "Source Han Sans SC", |
68 |
| - "Source Han Sans TC" |
69 |
| - } |
| 61 | + wezterm.on('toggle-maximize', function(window, pane) |
| 62 | + window:maximize() |
| 63 | + end) |
70 | 64 |
|
71 |
| - config.hide_tab_bar_if_only_one_tab = true |
72 |
| - config.scrollback_lines = 10000 |
73 |
| - config.enable_scroll_bar = true |
74 |
| - config.term = 'wezterm' |
| 65 | + -- This is where you actually apply your config choices |
| 66 | + config.color_scheme = "Catppuccin Mocha" |
| 67 | + config.font = wezterm.font_with_fallback { |
| 68 | + "JetBrainsMono Nerd Font", |
| 69 | + "FiraCode Nerd Font", |
75 | 70 |
|
76 |
| - config.keys = { |
77 |
| - -- toggle opacity(CTRL + SHIFT + B) |
78 |
| - { |
79 |
| - key = 'B', |
80 |
| - mods = 'CTRL', |
81 |
| - action = wezterm.action.EmitEvent 'toggle-opacity', |
82 |
| - }, |
83 |
| - { |
84 |
| - key = 'M', |
85 |
| - mods = 'CTRL', |
86 |
| - action = wezterm.action.EmitEvent 'toggle-maximize', |
87 |
| - }, |
88 |
| - } |
89 |
| - config.font_size = ${fontsize} |
| 71 | + -- To avoid 'Chinese characters displayed as variant (Japanese) glyphs' |
| 72 | + "Source Han Sans SC", |
| 73 | + "Source Han Sans TC" |
| 74 | + } |
90 | 75 |
|
91 |
| - -- To resolve issues: |
92 |
| - -- 1. https://github.com/ryan4yin/nix-config/issues/26 |
93 |
| - -- 2. https://github.com/ryan4yin/nix-config/issues/8 |
94 |
| - -- Spawn a nushell in login mode via `bash` |
95 |
| - config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' } |
| 76 | + config.hide_tab_bar_if_only_one_tab = true |
| 77 | + config.scrollback_lines = 10000 |
| 78 | + config.enable_scroll_bar = true |
| 79 | + config.term = 'wezterm' |
96 | 80 |
|
97 |
| - return config |
98 |
| - ''; |
99 |
| - } |
100 |
| - // ( |
101 |
| - if pkgs.stdenv.isDarwin |
102 |
| - then { |
103 |
| - # install wezterm via homebrew on macOS to avoid compilation, dummy package here. |
104 |
| - # package = pkgs.hello; |
105 |
| - enableBashIntegration = false; |
106 |
| - enableZshIntegration = false; |
| 81 | + config.keys = { |
| 82 | + -- toggle opacity(CTRL + SHIFT + B) |
| 83 | + { |
| 84 | + key = 'B', |
| 85 | + mods = 'CTRL', |
| 86 | + action = wezterm.action.EmitEvent 'toggle-opacity', |
| 87 | + }, |
| 88 | + { |
| 89 | + key = 'M', |
| 90 | + mods = 'CTRL', |
| 91 | + action = wezterm.action.EmitEvent 'toggle-maximize', |
| 92 | + }, |
107 | 93 | }
|
108 |
| - else {} |
109 |
| - ); |
| 94 | + config.font_size = ${fontsize} |
| 95 | +
|
| 96 | + -- To resolve issues: |
| 97 | + -- 1. https://github.com/ryan4yin/nix-config/issues/26 |
| 98 | + -- 2. https://github.com/ryan4yin/nix-config/issues/8 |
| 99 | + -- Spawn a nushell in login mode via `bash` |
| 100 | + config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' } |
| 101 | +
|
| 102 | + return config |
| 103 | + ''; |
| 104 | + }; |
110 | 105 | }
|
0 commit comments