|
18 | 18 | ---@class Deprecated |
19 | 19 | ---NOTE: THIS IS DELIBERATELY LEFT EMPTY |
20 | 20 |
|
| 21 | +---@alias ColorSpec table<"AnsiColor", AnsiColor>|table<"Color", string> |
| 22 | + |
21 | 23 | ---@alias FormatItemAttribute |
22 | 24 | ---|{ Underline: "None"|"Single"|"Double"|"Curly"|"Dotted"|"Dashed" } |
23 | 25 | ---|{ Intensity: "Normal"|"Bold"|"Half" } |
|
46 | 48 | ---|"SHIFT" |
47 | 49 | ---|"SUPER" |
48 | 50 |
|
49 | | ----@alias IntegratedTitleButton |
50 | | ----|"Hide" |
51 | | ----|"Maximize" |
52 | | ----|"Close" |
53 | | - |
54 | | ----@alias IntegratedTitleButtonAlignment |
55 | | ----|"Right" |
56 | | ----|"Left" |
57 | | - |
58 | | ----@alias IntegratedTitleButtonStyle |
59 | | ----|"Windows" |
60 | | ----|"Gnome" |
61 | | ----|"MacOsNative" |
62 | | - |
63 | 51 | ---Configures whether the window has a title bar and/or resizable border. |
64 | 52 | --- |
65 | 53 | ---The value is a set of flags: |
|
109 | 97 | ---|string |
110 | 98 | ---Add other valid combinations if needed |
111 | 99 |
|
112 | | ----@alias TabBarIntensity |
113 | | ----|"Normal" |
114 | | ----|"Half" |
115 | | ----|"Bold" |
116 | | - |
117 | | ----@alias TabBarUnderline |
118 | | ----|"None" |
119 | | ----|"Single" |
120 | | ----|"Double" |
121 | | - |
122 | 100 | ---@alias PaletteAnsi |
123 | 101 | ---|"black" |
124 | 102 | ---|"maroon" |
|
169 | 147 | --- |
170 | 148 | ---The default is `"Normal"`. |
171 | 149 | --- |
172 | | ----@field intensity? TabBarIntensity |
| 150 | +---@field intensity? "Normal"|"Half"|"Bold" |
173 | 151 | ---Specify whether you want `"None"`, `"Single"` or `"Double"` underline for |
174 | 152 | ---label shown for this tab. |
175 | 153 | --- |
176 | 154 | ---The default is `"None"`. |
177 | 155 | --- |
178 | | ----@field underline? TabBarUnderline |
| 156 | +---@field underline? "None"|"Single"|"Double" |
179 | 157 | ---Specify whether you want the text to be italic for this tab. |
180 | 158 | --- |
181 | 159 | ---The default is `false`. |
|
201 | 179 | ---The color of the strip that goes along the top of the window |
202 | 180 | ---(does not apply when fancy tab bar is in use). |
203 | 181 | --- |
204 | | ----@field background string |
| 182 | +---@field background? string |
205 | 183 | ---The active tab is the one that has focus in the window. |
206 | 184 | --- |
207 | | ----@field active_tab TabBarColor |
| 185 | +---@field active_tab? TabBarColor |
208 | 186 | ---Inactive tabs are the tabs that do not have focus. |
209 | 187 | --- |
210 | | ----@field inactive_tab TabBarColor |
| 188 | +---@field inactive_tab? TabBarColor |
211 | 189 | ---You can configure some alternate styling when the mouse pointer |
212 | 190 | ---moves over inactive tabs. |
213 | 191 | --- |
214 | | ----@field inactive_tab_hover TabBarColor |
| 192 | +---@field inactive_tab_hover? TabBarColor |
215 | 193 | ---The new tab button that let you create new tabs. |
216 | 194 | --- |
217 | | ----@field new_tab TabBarColor |
| 195 | +---@field new_tab? TabBarColor |
218 | 196 | ---You can configure some alternate styling when the mouse pointer |
219 | 197 | ---moves over the new tab button. |
220 | 198 | --- |
221 | | ----@field new_tab_hover TabBarColor |
222 | | - |
223 | | ----@alias ColorSpec table<"AnsiColor", AnsiColor>|table<"Color", string> |
| 199 | +---@field new_tab_hover? TabBarColor |
224 | 200 |
|
225 | 201 | ---@class Palette |
226 | 202 | ---The text color to use when the attributes are reset to default. |
|
252 | 228 | ---@field brights? table<integer, PaletteBrights> |
253 | 229 | ---A map for setting arbitrary colors ranging from 16 to 256 in the color palette. |
254 | 230 | --- |
255 | | ----@field indexed? string[]|table |
| 231 | +---@field indexed? string[] |
256 | 232 | ---The color of the "thumb" of the scrollbar; the segment that represents |
257 | 233 | ---the current viewable area. |
258 | 234 | --- |
|
289 | 265 | --- - `"White"` |
290 | 266 | --- |
291 | 267 | ---@field copy_mode_active_highlight_fg? ColorSpec |
292 | | ----Colors for copy_mode and quick_select. |
| 268 | +---Colors for `copy_mode` and `quick_select`. |
293 | 269 | --- |
294 | | ----In copy_mode, the color of the active text is: |
295 | | ----1. `copy_mode_active_highlight` if additional text was selected using the mouse |
296 | | ----2. `selection` otherwise |
| 270 | +---In `copy_mode`, the color of the active text is: |
| 271 | +--- 1. `copy_mode_active_highlight` if additional text was selected using the mouse |
| 272 | +--- 2. `selection` otherwise |
297 | 273 | --- |
298 | 274 | ---@field copy_mode_active_highlight_bg? ColorSpec |
299 | 275 | ---Use [`AnsiColor`](lua://AnsiColor) to specify one of the ansi color palette values |
|
317 | 293 | --- - `"White"` |
318 | 294 | --- |
319 | 295 | ---@field copy_mode_inactive_highlight_fg? ColorSpec |
320 | | ----Colors for copy_mode and quick_select. |
| 296 | +---Colors for `copy_mode` and `quick_select`. |
321 | 297 | --- |
322 | | ----In copy_mode, the color of the active text is: |
323 | | ----1. `copy_mode_active_highlight` if additional text was selected using the mouse |
324 | | ----2. `selection` otherwise |
| 298 | +---In `copy_mode`, the color of the active text is: |
| 299 | +--- |
| 300 | +--- 1. `copy_mode_active_highlight` if additional text was selected using the mouse |
| 301 | +--- 2. `selection` otherwise |
325 | 302 | --- |
326 | 303 | ---@field copy_mode_inactive_highlight_bg? ColorSpec |
327 | 304 | ---@field quick_select_label_fg? ColorSpec |
|
359 | 336 | ---|"UltraCondensed" |
360 | 337 | ---|"UltraExpanded" |
361 | 338 |
|
362 | | ----@alias FontStyle |
363 | | ----|"Normal" |
364 | | ----|"Italic" |
365 | | ----|"Oblique" |
366 | | - |
367 | 339 | ---@alias FreeTypeLoadTarget |
368 | 340 | ---|"Normal" |
369 | 341 | ---|"HorizontalLcd" |
|
380 | 352 | ---|"NO_AUTOHINT" |
381 | 353 |
|
382 | 354 | ---TODO: Find out what do the undocumented options do |
| 355 | + |
383 | 356 | ---@alias HarfbuzzFeatures |
384 | 357 | ---|"calt=0" |
385 | 358 | ---|"clig=0" |
|
439 | 412 | ---@field stretch? FontStretch |
440 | 413 | ---Whether the font should be an italic variant. |
441 | 414 | --- |
442 | | ----@field style? FontStyle |
| 415 | +---@field style? "Normal"|"Italic"|"Oblique" |
443 | 416 | ---@field is_fallback? boolean |
444 | 417 | ---@field is_synthetic? boolean |
445 | 418 | ---@field scale? number |
|
448 | 421 | --- |
449 | 422 | ---@class FontFamilyAttributes: FontAttributes |
450 | 423 | ---@field family string |
451 | | - |
452 | | ----@class FontFamilyExtendedAttributes: FontFamilyAttributes |
453 | 424 | ---@field harfbuzz_features? HarfbuzzFeatures[] |
454 | 425 | ---@field freetype_load_target? FreeTypeLoadTarget |
455 | 426 | ---@field freetype_render_target? FreeTypeLoadTarget |
|
992 | 963 | --- |
993 | 964 | ---@field battery_info fun(): BatteryInfo[] |
994 | 965 | ---Given a `string` parameter, returns the number of columns that text occupies |
995 | | ----in the terminal, which is useful together with `format-tab-title` and `update-right-status` |
996 | | ----to compute/layout tabs and status information. |
| 966 | +---in the terminal. |
| 967 | +--- |
| 968 | +---This is useful together with the `"format-tab-title"` and `"update-right-status"` |
| 969 | +---events to compute/layout tabs and status information. |
997 | 970 | --- |
998 | 971 | ---@field column_width fun(value: string): number |
999 | 972 | ---Returns a `Config` object that can be used to define your configuration. |
|
1034 | 1007 | ---but with `"WSL:"` prefixed to it. |
1035 | 1008 | --- |
1036 | 1009 | ---@field default_wsl_domains fun(): WslDomain[] |
1037 | | ----@field emit fun(event: string, ...: any) |
| 1010 | +---`wezterm.emit` resolves the registered callback(s) for the specified event name |
| 1011 | +---and calls each of them in turn, passing the additional arguments |
| 1012 | +---through to the callback. |
| 1013 | +--- |
| 1014 | +---If a callback returns `false` then it prevents later callbacks from being called |
| 1015 | +---for this particular call to `wezterm.emit`, and `wezterm.emit` will return `false` |
| 1016 | +---to indicate that no additional/default processing should take place. |
| 1017 | +--- |
| 1018 | +---If none of the callbacks returned `false` then `wezterm.emit` will itself return `true` |
| 1019 | +---to indicate that default processing should take place. |
| 1020 | +--- |
| 1021 | +---This function has no special knowledge of which events are defined by wezterm, |
| 1022 | +---or what their required arguments might be. |
| 1023 | +--- |
| 1024 | +---See [`wezterm.on`](lua://Wezterm.on) for more information about event handling. |
| 1025 | +--- |
| 1026 | +---@field emit fun(event: string, ...: any): boolean |
1038 | 1027 | ---This function will parse your ssh configuration file(s) and extract from them |
1039 | 1028 | ---the set of literal (non-pattern, non-negated) host names that are specified |
1040 | 1029 | ---in `Host` and `Match` stanzas contained in those configuration files |
|
1047 | 1036 | ---This constant is set to the directory containing the wezterm executable file. |
1048 | 1037 | --- |
1049 | 1038 | ---@field executable_dir string |
1050 | | ----This function constructs a Lua table that corresponds to the internal [`FontAttributes`](lua://FontAttributes) struct |
1051 | | ----that is used to select a single named font: |
1052 | | ---- |
1053 | | ----```lua |
1054 | | ----local wezterm = require 'wezterm' |
1055 | | ---- |
1056 | | ----return { |
1057 | | ---- font = wezterm.font 'JetBrains Mono', |
1058 | | ----} |
1059 | | ----``` |
1060 | | ---- |
1061 | | ----The first parameter is the name of the font; the name can be one of the following types of names: |
1062 | | ---- |
1063 | | ---- - The font family name, e.g. `"JetBrains Mono"`. The family name doesn't include any style information |
1064 | | ---- (such as `weight`, `stretch` or `italic`), which can be specified via the `attributes` parameter. |
1065 | | ---- This is the recommended name to use for the font, as it the most compatible way to resolve |
1066 | | ---- an installed font. |
1067 | | ---- - The computed full name, which is the family name with the sub-family |
1068 | | ---- (which incorporates style information) appended, e.g. `"JetBrains Mono Regular"`. |
1069 | | ---- - The postscript name, which is an ostensibly unique name identifying a given font and style |
1070 | | ---- that is encoded into the font by the font designer. |
1071 | | ---- |
1072 | | ----When specifying a font using its family name, the second attributes parameter is |
1073 | | ----an **optional** table that can be used to specify style attributes. |
1074 | | ---- |
1075 | | ----See [`FontAttributes`](lua://FontAttributes) |
1076 | | ----See [`FontFamilyAttributes`](lua://FontFamilyAttributes) |
1077 | | ----See [`FontFamilyExtendedAttributes`](lua://FontFamilyExtendedAttributes) |
1078 | | ---- |
1079 | | ----@field font (fun(attributes: FontFamilyAttributes|FontFamilyExtendedAttributes): FontFamilyAttributes)|(fun(name: string, attributes: FontAttributes?): FontFamilyAttributes) |
1080 | 1039 | ---TODO: Complete description. |
1081 | 1040 | --- |
1082 | 1041 | ---[Info](https://wezterm.org/config/lua/wezterm/font_with_fallback.html). |
|
1117 | 1076 | ---@field log_info fun(msg: string, ...: any) |
1118 | 1077 | ---@field log_warn fun(msg: string, ...: any) |
1119 | 1078 | ---@field open_with fun(path_or_url: string, application: string?) |
1120 | | ----@field pad_left fun(string: string, min_width: integer): string Returns a copy of string that is at least min_width columns (as measured by wezterm.column_width) |
1121 | | ----@field pad_right fun(string: string, min_width: integer): string Returns a copy of string that is at least min_width columns (as measured by wezterm.column_width). |
1122 | | ----@field permute_any_or_no_mods any #TODO |
| 1079 | +---Returns a copy of a string that is at least `min_width` columns |
| 1080 | +---(as measured by `wezterm.column_width()`). |
| 1081 | +--- |
| 1082 | +---@field pad_left fun(string: string, min_width: integer): string |
| 1083 | +---Returns a copy of a string that is at least min_width columns |
| 1084 | +---(as measured by `wezterm.column_width()`). |
| 1085 | +--- |
| 1086 | +---@field pad_right fun(string: string, min_width: integer): string |
| 1087 | +---@field permute_any_or_no_mods any |
1123 | 1088 | ---@field permute_any_mods (fun(tbl: MouseBindingBase): MouseBinding)|(fun(tbl: KeyBindingBase): KeyBinding) |
1124 | 1089 | ---@field read_dir fun(path: string): string Returns an array containing the absolute file names of the directory specified. Due to limitations in the Lua bindings, all of the paths must be able to be represented as UTF-8 or this function will generate an error. |
1125 | 1090 | ---@field reload_configuration fun(): nil Immediately causes the configuration to be reloaded and re-applied. |
|
1130 | 1095 | ---@field shell_split fun(line: string): string[] Splits a command line into an argument array according to posix shell rules. |
1131 | 1096 | ---@field sleep_ms fun(milliseconds: number): nil wezterm.sleep_ms suspends execution of the script for the specified number of milliseconds. After that time period has elapsed, the script continues running at the next statement. |
1132 | 1097 | ---@field split_by_newlines fun(string: string): string[] takes the input string and splits it by newlines (both \n and \r\n are recognized as newlines) and returns the result as an array of strings that have the newlines removed. |
1133 | | ----@field strftime fun(format: string): string Formats the current local date/time into a string using the Rust chrono strftime syntax. |
1134 | | ----@field strftime_utc fun(format: string): string Formats the current UTC date/time into a string using the Rust chrono strftime syntax. |
1135 | | ----@field target_triple string This constant is set to the Rust target triple for the platform on which wezterm was built. This can be useful when you wish to conditionally adjust your configuration based on the platform. |
1136 | | ----@field truncate_left fun(string: string, max_width: number): string Returns a copy of string that is no longer than max_width columns (as measured by wezterm.column_width). Truncation occurs by reemoving excess characters from the left end of the string. |
1137 | | ----@field truncate_right fun(string: string, max_width: number): string Returns a copy of string that is no longer than max_width columns (as measured by wezterm.column_width). Truncation occurs by reemoving excess characters from the right end of the string. |
1138 | | ----@field utf16_to_utf8 fun(string: string): string Overly specific and exists primarily to workaround this wsl.exe issue. It takes as input a string and attempts to convert it from utf16 to utf8. |
| 1098 | +---Formats the current local date/time into a string using |
| 1099 | +---the Rust `chrono strftime` syntax. |
| 1100 | +--- |
| 1101 | +---@field strftime fun(format: string): string |
| 1102 | +---Formats the current UTC date/time into a string using |
| 1103 | +---the Rust `chrono strftime` syntax. |
| 1104 | +--- |
| 1105 | +---@field strftime_utc fun(format: string): string |
| 1106 | +---This constant is set to the Rust target triple for |
| 1107 | +---the platform on which wezterm was built. |
| 1108 | +--- |
| 1109 | +---This can be useful when you wish to conditionally adjust your configuration |
| 1110 | +---based on the platform. |
| 1111 | +--- |
| 1112 | +---@field target_triple string |
| 1113 | +---Returns a copy of a string that is no longer than `max_width` columns |
| 1114 | +---(as measured by `wezterm.column_width()`). |
| 1115 | +--- |
| 1116 | +---Truncation occurs by reemoving excess characters from the left end of the string. |
| 1117 | +--- |
| 1118 | +---@field truncate_left fun(string: string, max_width: number): string |
| 1119 | +---Returns a copy of a string that is no longer than `max_width` columns |
| 1120 | +---(as measured by `wezterm.column_width()`). |
| 1121 | +--- |
| 1122 | +---Truncation occurs by reemoving excess characters from the right end of the string. |
| 1123 | +--- |
| 1124 | +---@field truncate_right fun(string: string, max_width: number): string |
| 1125 | +---Overly specific and exists primarily to workaround this wsl.exe issue. |
| 1126 | +---It takes as input a string and attempts to convert it from utf16 to utf8. |
| 1127 | +--- |
| 1128 | +---@field utf16_to_utf8 fun(string: string): string |
1139 | 1129 | ---This constant is set to the wezterm version string that is also reported |
1140 | 1130 | ---by running `wezterm -V`. |
1141 | 1131 | --- |
1142 | | ----This can potentially be used to adjust configuration according to the installed version |
| 1132 | +---This can potentially be used to adjust configuration according to |
| 1133 | +---the installed version. |
| 1134 | +--- |
1143 | 1135 | ---@field version string |
1144 | 1136 | ---@field gradient_colors fun(gradient: Gradient, num_colors: number): Color[] |
1145 | 1137 | local Wezterm = {} |
@@ -1437,3 +1429,66 @@ function Wezterm.on(event, callback) end |
1437 | 1429 | ---@param event "window-resized" |
1438 | 1430 | ---@param callback CallbackWindowPane |
1439 | 1431 | function Wezterm.on(event, callback) end |
| 1432 | + |
| 1433 | +---This function constructs a Lua table that corresponds to the internal |
| 1434 | +---[`FontFamilyAttributes`](lua://FontFamilyAttributes) struct that is used to select a single named font: |
| 1435 | +--- |
| 1436 | +---```lua |
| 1437 | +---local wezterm = require 'wezterm' |
| 1438 | +--- |
| 1439 | +---return { |
| 1440 | +--- font = wezterm.font 'JetBrains Mono', |
| 1441 | +---} |
| 1442 | +---``` |
| 1443 | +--- |
| 1444 | +---The first parameter is the name of the font; the name can be one of the following types of names: |
| 1445 | +--- |
| 1446 | +--- - The font family name, e.g. `"JetBrains Mono"`. The family name doesn't include any style information |
| 1447 | +--- (such as `weight`, `stretch` or `italic`), which can be specified via the `attributes` parameter. |
| 1448 | +--- This is the recommended name to use for the font, as it the most compatible way to resolve |
| 1449 | +--- an installed font. |
| 1450 | +--- - The computed full name, which is the family name with the sub-family |
| 1451 | +--- (which incorporates style information) appended, e.g. `"JetBrains Mono Regular"`. |
| 1452 | +--- - The postscript name, which is an ostensibly unique name identifying a given font and style |
| 1453 | +--- that is encoded into the font by the font designer. |
| 1454 | +--- |
| 1455 | +---When specifying a font using its family name, the second attributes parameter is |
| 1456 | +---an **optional** table that can be used to specify style attributes. |
| 1457 | +--- |
| 1458 | +---See [`FontAttributes`](lua://FontAttributes) and [`FontFamilyAttributes`](lua://FontFamilyAttributes). |
| 1459 | +--- |
| 1460 | +---@param name string |
| 1461 | +---@param attributes? FontAttributes |
| 1462 | +---@return Fonts|FontFamilyAttributes |
| 1463 | +function Wezterm.font(name, attributes) end |
| 1464 | + |
| 1465 | +---This function constructs a Lua table that corresponds to the internal |
| 1466 | +---[`FontFamilyAttributes`](lua://FontFamilyAttributes) struct that is used to select a single named font. |
| 1467 | +--- |
| 1468 | +---You can use the expanded form mentioned above to override freetype and harfbuzz settings |
| 1469 | +---just for the specified font. |
| 1470 | +--- |
| 1471 | +---This example shows how to disable the default ligature feature just for this particular font: |
| 1472 | +--- |
| 1473 | +---```lua |
| 1474 | +---local wezterm = require 'wezterm' |
| 1475 | +---return { |
| 1476 | +--- font = wezterm.font { |
| 1477 | +--- family = 'JetBrains Mono', |
| 1478 | +--- harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' }, |
| 1479 | +--- }, |
| 1480 | +---} |
| 1481 | +---``` |
| 1482 | +--- |
| 1483 | +---The following options can be specified in the same way: |
| 1484 | +--- |
| 1485 | +--- - [`harfbuzz_features`](lua://FontFamilyAttributes.harfbuzz_features) |
| 1486 | +--- - [`freetype_load_target`](lua://FontFamilyAttributes.freetype_load_target) |
| 1487 | +--- - [`freetype_render_target`](lua://FontFamilyAttributes.freetype_render_target) |
| 1488 | +--- - [`freetype_load_flags`](lua://FontFamilyAttributes.freetype_load_flags) |
| 1489 | +--- - [`assume_emoji_presentation`](lua://FontFamilyAttributes.assume_emoji_presentation) to control |
| 1490 | +--- whether a font is considered to have emoji (rather than text) presentation glyphs for emoji |
| 1491 | +--- |
| 1492 | +---@param attributes FontFamilyAttributes |
| 1493 | +---@return Fonts|FontFamilyAttributes |
| 1494 | +function Wezterm.font(attributes) end |
0 commit comments