diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-05-06 13:56:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-06 13:56:12 +0100 |
| commit | 1681bea42dd2f11ba3fe6df05560d0b231de3c76 (patch) | |
| tree | 899103dbddf675a01758c7cdd379224c9c81a7fb /meta/hl.meta.lua | |
| parent | 5f1350f522d3fe3af78cbe30a98311763b3509d5 (diff) | |
config/lua: add simple layout API (#14258)
Adds a simple layout lua api
Diffstat (limited to 'meta/hl.meta.lua')
| -rw-r--r-- | meta/hl.meta.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/meta/hl.meta.lua b/meta/hl.meta.lua index 6ea875ae..6e34ff34 100644 --- a/meta/hl.meta.lua +++ b/meta/hl.meta.lua @@ -387,6 +387,35 @@ local __HL_Dispatcher = {} ---@field y number local __HL_Vec2 = {} +---@class HL.Box +---@field x number +---@field y number +---@field w number +---@field h number +local __HL_Box = {} + +---@class HL.LayoutTarget +---@field index integer +---@field window HL.Window|nil +---@field box HL.Box +---@field place fun(self: HL.LayoutTarget, box: HL.Box): nil +---@field set_box fun(self: HL.LayoutTarget, box: HL.Box): nil +local __HL_LayoutTarget = {} + +---@class HL.LayoutContext +---@field area HL.Box +---@field targets HL.LayoutTarget[] +---@field grid_cell fun(self: HL.LayoutContext, i: integer, cols: integer, rows?: integer): HL.Box +---@field column fun(self: HL.LayoutContext, i: integer, n: integer): HL.Box +---@field row fun(self: HL.LayoutContext, i: integer, n: integer): HL.Box +---@field split fun(self: HL.LayoutContext, box: HL.Box, side: 'left'|'right'|'top'|'bottom'|'up'|'down', ratio: number): HL.Box +local __HL_LayoutContext = {} + +---@class HL.LayoutProvider +---@field recalculate fun(ctx: HL.LayoutContext): nil +---@field layout_msg? fun(ctx: HL.LayoutContext, msg: string): boolean|string|nil +local __HL_LayoutProvider = {} + ---@class HL.BindOptions ---@field repeating? boolean ---@field locked? boolean @@ -783,6 +812,7 @@ local __HL_Workspace = {} ---@field window_rule fun(spec: HL.WindowRuleSpec): HL.WindowRule ---@field workspace_rule fun(spec: HL.WorkspaceRuleSpec): nil ---@field dsp HL.DspNamespace +---@field layout HL.LayoutNamespace ---@field notification HL.NotificationNamespace ---@field plugin HL.PluginNamespace local __HL_API = {} @@ -855,6 +885,10 @@ local __HL_DspWindowNamespace = {} ---@field toggle_special fun(...): HL.Dispatcher local __HL_DspWorkspaceNamespace = {} +---@class HL.LayoutNamespace +---@field register fun(name: string, provider: HL.LayoutProvider): nil +local __HL_LayoutNamespace = {} + ---@class HL.NotificationNamespace ---@field create fun(opts?: HL.NotificationOptions): HL.Notification ---@field get fun(): HL.Notification[] |
