Skip to content

Commit 4a6518b

Browse files
authored
feat(widgets.wez): add type annotations (#169)
Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent 58c95e0 commit 4a6518b

6 files changed

Lines changed: 126 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ This project also features type annotations for various WezTerm plugins.
114114
| [wezterm-sync](https://github.com/dfsramos/wezterm-sync) | [Documentation](docs/sync.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.sync.txt) |
115115
| [wezterm-tabs](https://github.com/yriveiro/wezterm-tabs) | [Documentation](docs/wezterm-tabs.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.wezterm-tabs.txt) |
116116
| [wezterm-theme-rotator](https://github.com/koh-sh/wezterm-theme-rotator) | [Documentation](docs/wezterm-theme-rotator.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.wezterm-theme-rotator.txt) |
117+
| [widgets.wez](https://github.com/usrivastava92/widgets.wez) | [Documentation](docs/widgets.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.widgets.txt) |
117118
| [workspace-picker.wezterm](https://github.com/isseii10/workspace-picker.wezterm) | [Documentation](docs/workspace-picker.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.workspace-picker.txt) |
118119
| [workspacesionizer.wezterm](https://github.com/vieitesss/workspacesionizer.wezterm) | [Documentation](docs/workspacesionizer.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.workspacesionizer.txt) |
119120
| [wsinit.wezterm](https://github.com/JuanraCM/wsinit.wezterm) | [Documentation](docs/wsinit.md) | [Neovim Helpdoc](doc/wezterm-types-plugin.wsinit.txt) |

doc/wezterm-types-plugin.widgets.txt

Whitespace-only changes.

doc/wezterm-types.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*wezterm-types.txt* For NVIM >=v0.7.0 Last change: 2026 June 09
1+
*wezterm-types.txt* For NVIM >=v0.7.0 Last change: 2026 June 23
22

33
==============================================================================
44
1. wezterm-types *wezterm-types-wezterm-types*
@@ -169,6 +169,8 @@ This project also features type annotations for various WezTerm plugins.
169169

170170
wezterm-theme-rotator Documentation Neovim Helpdoc
171171

172+
widgets.wez Documentation Neovim Helpdoc
173+
172174
workspace-picker.wezterm Documentation Neovim Helpdoc
173175

174176
workspacesionizer.wezterm Documentation Neovim Helpdoc

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ We will keep adding more community plugins as we find them.
5050
- [wezterm-sync](./sync.md)
5151
- [wezterm-tabs](./wezterm-tabs.md)
5252
- [wezterm-theme-rotator](./wezterm-theme-rotator.md)
53+
- [widgets.wez](./widgets.md)
5354
- [workspace-picker.wezterm](./workspace-picker.md)
5455
- [workspacesionizer.wezterm](./workspacesionizer.md)
5556
- [wsinit.wezterm](./wsinit.md)

docs/widgets.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### `widgets.wez`
2+
3+
You can import type annotations for
4+
[`usrivastava92/widgets.wez`](https://github.com/usrivastava92/widgets.wez) as shown below:
5+
6+
```lua
7+
---@type Widgets
8+
local sys = wezterm.plugin.require("https://github.com/usrivastava92/widgets.wez")
9+
```
10+
11+
<!-- vim: set ts=2 sts=2 sw=2 et ai si sta: -->
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---@meta
2+
---@diagnostic disable:unused-local
3+
4+
---@class Widgets.WidgetOpts
5+
---@field color? string
6+
---@field icon? string|false
7+
---@field throttle? integer
8+
9+
---@class WidgetsOpts
10+
---@field left? Widgets.Widget[]
11+
---@field right? Widgets.Widget[]
12+
---@field separator? { text?: string, color?: string }
13+
14+
---@class Widgets.Battery
15+
---@field charge Widgets.Battery.Charge
16+
17+
---@class Widgets.CPU
18+
---@field utilization Widgets.CPU.Utilization
19+
20+
---@class Widgets.Disk
21+
---@field read Widgets.Disk.Read
22+
---@field space Widgets.Disk.Space
23+
---@field write Widgets.Disk.Write
24+
25+
---@class Widgets.Network
26+
---@field download Widgets.Network.Download
27+
---@field upload Widgets.Network.Upload
28+
29+
---@class Widgets.RAM
30+
---@field utilization Widgets.RAM.Utilization
31+
32+
---@class Widgets.CPU.Utilization
33+
local U = {}
34+
35+
---@param opts? WidgetsOpts
36+
---@return Widgets.Widget widget
37+
function U.widget(opts) end
38+
39+
---@class Widgets.Battery.Charge
40+
local C = {}
41+
42+
---@param opts? WidgetsOpts
43+
---@return Widgets.Widget widget
44+
function C.widget(opts) end
45+
46+
---@class Widgets.Disk.Read
47+
local R = {}
48+
49+
---@param opts? WidgetsOpts
50+
---@return Widgets.Widget widget
51+
function R.widget(opts) end
52+
53+
---@class Widgets.Disk.Space
54+
local S = {}
55+
56+
---@param opts? WidgetsOpts
57+
---@return Widgets.Widget widget
58+
function S.widget(opts) end
59+
60+
---@class Widgets.Disk.Write
61+
local Write = {}
62+
63+
---@param opts? WidgetsOpts
64+
---@return Widgets.Widget widget
65+
function Write.widget(opts) end
66+
67+
---@class Widgets.Network.Download
68+
local D = {}
69+
70+
---@param opts? WidgetsOpts
71+
---@return Widgets.Widget widget
72+
function D.widget(opts) end
73+
74+
---@class Widgets.RAM.Utilization
75+
local RU = {}
76+
77+
---@param opts? WidgetsOpts
78+
---@return Widgets.Widget widget
79+
function RU.widget(opts) end
80+
81+
---@class Widgets.Network.Upload
82+
local Upload = {}
83+
84+
---@param opts? WidgetsOpts
85+
---@return Widgets.Widget widget
86+
function Upload.widget(opts) end
87+
88+
---@class Widgets.Widget
89+
---@field opts Widgets.WidgetOpts
90+
local W = {}
91+
92+
---@return string formatted
93+
function W.get_text() end
94+
95+
---@return { [1]: { Foreground: string }, [2]: { Text: string } }
96+
function W.get_formatted() end
97+
98+
---@class Widgets
99+
---@field battery Widgets.Battery
100+
---@field cpu Widgets.CPU
101+
---@field disk Widgets.Disk
102+
---@field network Widgets.Network
103+
---@field ram Widgets.RAM
104+
local M = {}
105+
106+
---@param config Config
107+
---@param opts WidgetsOpts
108+
function M.apply_to_config(config, opts) end
109+
110+
-- vim: set ts=2 sts=2 sw=2 et ai si sta:

0 commit comments

Comments
 (0)