Skip to content

Commit 83d3ba9

Browse files
committed
fix(config): moved some types to enums
Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent 7c6641e commit 83d3ba9

1 file changed

Lines changed: 60 additions & 9 deletions

File tree

lua/wezterm/types/config.lua

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,51 @@
66
---@module "wezterm.types.wezterm"
77
---@module "wezterm.types.harfbuzz"
88

9+
---@enum (key) Config.FrontEnd
10+
local front_end = {
11+
OpenGL = 1,
12+
Software = 1,
13+
WebGpu = 1,
14+
}
15+
16+
---@enum (key) FreeTypeLoadTarget
17+
local freetype_load_target = {
18+
HorizontalLcd = 1,
19+
Light = 1,
20+
Mono = 1,
21+
Normal = 1,
22+
VerticalLcd = 1,
23+
}
24+
25+
---@enum (key) Config.FontLocator
26+
local font_locator = {
27+
ConfigDirsOnly = 1,
28+
CoreText = 1,
29+
FontConfig = 1,
30+
Gdi = 1,
31+
}
32+
33+
---@enum (key) FontShaper
34+
local font_shaper = {
35+
Allsorts = 1,
36+
Harfbuzz = 1,
37+
}
38+
39+
---@enum (key) FontRasterizer
40+
local font_rasterizer = {
41+
FreeType = 1,
42+
Harfbuzz = 1,
43+
}
44+
45+
---@enum (key) Config.Win32SystemBackdrop
46+
local win32_system_backdrop = {
47+
Acrylic = 1,
48+
Auto = 1,
49+
Disable = 1,
50+
Mica = 1,
51+
Tabbed = 1,
52+
}
53+
954
---@enum (key) QuickSelectAlphabet
1055
local QSA = {
1156
aoeuqjkxpyhtnsgcrlmwvzfidb = 1,
@@ -15,6 +60,12 @@ local QSA = {
1560
qsdfazerwxcvjklmuiopghtybn = 1,
1661
}
1762

63+
---@enum (key) Config.WebGpuPowerPreference
64+
local webgpu_power_preference = {
65+
HighPerformance = 1,
66+
LowPower = 1,
67+
}
68+
1869
---@enum (key) DroppedFileQuoting
1970
local DFQ = {
2071
None = 1,
@@ -1058,7 +1109,7 @@ local exit_behavior_messaging = {
10581109
--- - [`wezterm.font_with_fallback()`](lua://Wezterm.font_with_fallback)
10591110
---
10601111
---@field font? AllFontAttributes
1061-
---@field font_colr_rasterizer? "FreeType"|"Harfbuzz"
1112+
---@field font_colr_rasterizer? FontRasterizer
10621113
---By default, wezterm will use an appropriate system-specific method
10631114
---for locating the fonts that you specify using the options below.
10641115
---Additionally, if you configure the `config.font_dirs` option,
@@ -1099,11 +1150,11 @@ local exit_behavior_messaging = {
10991150
---
11001151
---Otherwise, it is recommended to omit this setting.
11011152
---
1102-
---@field font_locator? "FontConfig"|"Gdi"|"CoreText"|"ConfigDirsOnly"
1153+
---@field font_locator? Config.FontLocator
11031154
---Specifies the method by which fonts are rendered on screen.
11041155
---Possible values are `"FreeType"` and `"Harfbuzz"`.
11051156
---
1106-
---@field font_rasterizer? "FreeType"|"Harfbuzz"
1157+
---@field font_rasterizer? FontRasterizer
11071158
---When textual output in the terminal is styled with `bold`, `italic`
11081159
---or other attributes, wezterm uses `config.font_rules` to decide
11091160
---how to render that text.
@@ -1144,7 +1195,7 @@ local exit_behavior_messaging = {
11441195
---
11451196
---Possible values are `"Harfbuzz"` and `"Allsorts"`.
11461197
---
1147-
---@field font_shaper? "Harfbuzz"|"Allsorts"
1198+
---@field font_shaper? FontShaper
11481199
---Specifies the size of the font, measured in points.
11491200
---
11501201
---You may use fractional point sizes, such as `13.3`,
@@ -1282,7 +1333,7 @@ local exit_behavior_messaging = {
12821333
---[`wezterm.font`](lua://Wezterm.font)
12831334
---override is not sufficient.
12841335
---
1285-
---@field freetype_load_target? "Normal"|"HorizontalLcd"|"Light"|"Mono"|"VerticalLcd"
1336+
---@field freetype_load_target? FreeTypeLoadTarget
12861337
---This option provides control over the [no-long-family-names](https://freetype.org/freetype2/docs/reference/ft2-properties.html#no-long-family-names)
12871338
---FreeType PCF font driver property.
12881339
---
@@ -1335,7 +1386,7 @@ local exit_behavior_messaging = {
13351386
---config.freetype_render_target = 'HorizontalLcd'
13361387
---```
13371388
---
1338-
---@field freetype_render_target? "Normal"|"HorizontalLcd"|"Light"|"Mono"|"VerticalLcd"
1389+
---@field freetype_render_target? FreeTypeLoadTarget
13391390
---Specify the features to enable when using harfbuzz for font shaping.
13401391
---
13411392
---There is some light documentation [here](https://harfbuzz.github.io/shaping-opentype-features.html).
@@ -1366,7 +1417,7 @@ local exit_behavior_messaging = {
13661417
--- - Vulkan
13671418
--- - DirectX 12 (on Windows)
13681419
---
1369-
---@field front_end? "OpenGL"|"WebGpu"|"Software"
1420+
---@field front_end? Config.FrontEnd
13701421
---@field glyph_cache_image_cache_size? integer
13711422
---When `config.font_shaper = "Harfbuzz"`, this setting affects how font shaping takes place.
13721423
---
@@ -2552,7 +2603,7 @@ local exit_behavior_messaging = {
25522603
---
25532604
---Defaults to `"LowPower"`.
25542605
---
2555-
---@field webgpu_power_preference? "LowPower"|"HighPerformance"
2606+
---@field webgpu_power_preference? Config.WebGpuPowerPreference
25562607
---Specifies which `WebGpu` adapter should be used.
25572608
---
25582609
---This option is only applicable when you have set `"WebGpu"` to
@@ -2572,7 +2623,7 @@ local exit_behavior_messaging = {
25722623
---[`config.window_background_opacity`](lua://Config.window_background_opacity)
25732624
---it chooses from available window background effects provided by Windows.
25742625
---
2575-
---@field win32_system_backdrop? "Auto"|"Disable"|"Acrylic"|"Mica"|"Tabbed"
2626+
---@field win32_system_backdrop? Config.Win32SystemBackdrop
25762627
---Dynamically generates a
25772628
---[`config.window_background_image`](lua://Config.window_background_image)
25782629
---from the provided gradient specification.

0 commit comments

Comments
 (0)