Update api

This commit is contained in:
Ottatop 2023-08-14 14:35:06 -05:00
parent eb85c92164
commit dfa4c65929
2 changed files with 150 additions and 44 deletions

View file

@ -121,17 +121,32 @@ function window_module.class(win) end
---@see Window.title
function window_module.title(win) end
---Get `win`'s status.
---Toggle `win`'s floating status.
---
---When used on a floating window, this will change it to tiled, and vice versa.
---
---When used on a fullscreen or maximized window, this will still change its
---underlying floating/tiled status.
---@tparam Window win
---@treturn string|nil One of `"Floating"`, `"Tiled"`, `"Fullscreen"`, `"Maximized"`, or `nil`.
---@see Window.status
function window_module.status(win) end
function window_module.toggle_floating(win) end
---Set `win`'s status.
---Toggle `win`'s fullscreen status.
---
---When used on a fullscreen window, this will change the window back to
---floating or tiled.
---
---When used on a non-fullscreen window, it becomes fullscreen.
---@tparam Window win
---@tparam string status One of `"Floating"`, `"Tiled"`, `"Fullscreen"`, or `"Maximized"`.
---@see Window.set_status
function window_module.set_status(win, status) end
function window_module.toggle_fullscreen(win) end
---Toggle `win`'s maximized status.
---
---When used on a maximized window, this will change the window back to
---floating or tiled.
---
---When used on a non-maximized window, it becomes maximized.
---@tparam Window win
function window_module.toggle_maximized(win) end
---Get whether or not this window is focused.
---
@ -145,6 +160,18 @@ function window_module.set_status(win, status) end
---@see Window.focused
function window_module.focused(win) end
---Get whether or not `win` is floating (true) or tiled (false).
---@treturn boolean|nil
function window_module.floating(win) end
---Get whether or not `win` is fullscreen.
---@treturn boolean|nil
function window_module.fullscreen(win) end
---Get whether or not `win` is maximized.
---@treturn boolean|nil
function window_module.maximized(win) end
--------------------------------------------------------
---The window object.
@ -240,21 +267,49 @@ function window:class() end
---@see WindowModule.title
function window:title() end
---Get this window's status.
---@treturn string|nil One of `"Floating"`, `"Tiled"`, `"Fullscreen"`, `"Maximized"`, or `nil`.
---@see WindowModule.status
function window:status() end
---Get `win`'s status.
---Toggle this window's floating status.
---
---When used on a floating window, this will change it to tiled, and vice versa.
---
---When used on a fullscreen or maximized window, this will still change its
---underlying floating/tiled status.
---@tparam Window win
---@tparam string status One of `"Floating"`, `"Tiled"`, `"Fullscreen"`, or `"Maximized"`.
---@see WindowModule.set_status
function window:set_status(win, status) end
function window:toggle_floating(win) end
---Toggle this window's fullscreen status.
---
---When used on a fullscreen window, this will change the window back to
---floating or tiled.
---
---When used on a non-fullscreen window, it becomes fullscreen.
---@tparam Window win
function window:toggle_fullscreen(win) end
---Toggle this window's maximized status.
---
---When used on a maximized window, this will change the window back to
---floating or tiled.
---
---When used on a non-maximized window, it becomes maximized.
---@tparam Window win
function window:toggle_maximized(win) end
---Get whether or not this window is focused.
---
---@usage
---print(window.get_focused():focused()) -- should print `true`.
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
---@treturn boolean|nil floating `true` if it's focused, `false` if it's tiled, or nil if it doesn't exist.
---@see WindowModule.focused
function window:focused() end
---Get whether or not this window is floating (true) or tiled (false).
---@treturn boolean|nil
function window:floating() end
---Get whether or not this window is fullscreen.
---@treturn boolean|nil
function window:fullscreen() end
---Get whether or not this window is maximized.
---@treturn boolean|nil
function window:maximized() end

View file

@ -151,49 +151,55 @@ function window:title()
return window_module.title(self)
end
---Get this window's status.
---Get this window's floating status.
---@return boolean|nil
---@see WindowModule.status — The corresponding module function
---@see WindowModule.floating — The corresponding module function
function window:floating()
return window_module.floating(self)
end
---Get this window's status.
---Get this window's fullscreen status.
---@return boolean|nil
---@see WindowModule.status — The corresponding module function
---@see WindowModule.fullscreen — The corresponding module function
function window:fullscreen()
return window_module.fullscreen(self)
end
---Get this window's status.
---Get this window's maximized status.
---@return boolean|nil
---@see WindowModule.status — The corresponding module function
---@see WindowModule.maximized — The corresponding module function
function window:maximized()
return window_module.maximized(self)
end
---Toggle this window's floating status.
---
---When used on a floating window, this will change it to tiled, and vice versa.
---
---When used on a fullscreen or maximized window, this will still change its
---underlying floating/tiled status.
function window:toggle_floating()
SendMsg({
ToggleFloating = {
window_id = self:id(),
},
})
window_module.toggle_floating(self)
end
---Toggle this window's fullscreen status.
---
---When used on a fullscreen window, this will change the window back to
---floating or tiled.
---
---When used on a non-fullscreen window, it becomes fullscreen.
function window:toggle_fullscreen()
SendMsg({
ToggleFullscreen = {
window_id = self:id(),
},
})
window_module.toggle_fullscreen(self)
end
---Toggle this window's maximized status.
---
---When used on a maximized window, this will change the window back to
---floating or tiled.
---
---When used on a non-maximized window, it becomes maximized.
function window:toggle_maximized()
SendMsg({
ToggleMaximized = {
window_id = self:id(),
},
})
window_module.toggle_maximized(self)
end
---Get whether or not this window is focused.
@ -202,7 +208,7 @@ end
---```lua
---print(window.get_focused():focused()) -- should print `true`.
---```
---@return boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
---@return boolean|nil
---@see WindowModule.focused — The corresponding module function
function window:focused()
return window_module.focused(self)
@ -347,6 +353,51 @@ function window_module.move_to_tag(w, name, output)
end
end
---Toggle `win`'s floating status.
---
---When used on a floating window, this will change it to tiled, and vice versa.
---
---When used on a fullscreen or maximized window, this will still change its
---underlying floating/tiled status.
---@param win Window
function window_module.toggle_floating(win)
SendMsg({
ToggleFloating = {
window_id = win:id(),
},
})
end
---Toggle `win`'s fullscreen status.
---
---When used on a fullscreen window, this will change the window back to
---floating or tiled.
---
---When used on a non-fullscreen window, it becomes fullscreen.
---@param win Window
function window_module.toggle_fullscreen(win)
SendMsg({
ToggleFloating = {
window_id = win:id(),
},
})
end
---Toggle `win`'s maximized status.
---
---When used on a maximized window, this will change the window back to
---floating or tiled.
---
---When used on a non-maximized window, it becomes maximized.
---@param win Window
function window_module.toggle_maximized(win)
SendMsg({
ToggleFloating = {
window_id = win:id(),
},
})
end
---Set the specified window's size.
---
---### Examples
@ -505,7 +556,7 @@ end
---Get this window's floating status.
---@param win Window
---@return boolean|nil
---@see Window.status — The corresponding object method
---@see Window.floating — The corresponding object method
function window_module.floating(win)
local response = Request({
GetWindowProps = {
@ -519,7 +570,7 @@ end
---Get this window's fullscreen status.
---@param win Window
---@return boolean|nil
---@see Window.status — The corresponding object method
---@see Window.fullscreen — The corresponding object method
function window_module.fullscreen(win)
local response = Request({
GetWindowProps = {
@ -534,7 +585,7 @@ end
---Get this window's maximized status.
---@param win Window
---@return boolean|nil
---@see Window.status — The corresponding object method
---@see Window.maximized — The corresponding object method
function window_module.maximized(win)
local response = Request({
GetWindowProps = {
@ -556,7 +607,7 @@ end
---end
---```
---@param win Window
---@return boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
---@return boolean|nil
---@see Window.focused — The corresponding object method
function window_module.focused(win)
local response = Request({